Jump to content

Java Open JDK 11, Digest Auth HTTPUrlConnection

Go to solution Solved by W1ll1aming,
7 minutes ago, WillLTT said:

--snip--

Did some further header searching & digging, HTTPUrlConnection does not support digest auth.

https://stackoverflow.com/questions/32689185/digest-authentication-in-android-using-httpurlconnection

How do i pass Username and Password in GET Request in Java HTTPURLConnection?

 

i did some searching and found this:

https://stackoverflow.com/questions/27150388/how-to-pass-username-and-password-in-get-request-in-java

However it does not work, Also they seem to use another base64 library than me, i just use the standard one, And the comment saying try with putting the auth right into the encodeToString function does not work either:

String encoded = Base64.getEncoder().encodeToString(("test:server1").getBytes());

connection.setRequestProperty("Authorization", "Basic "+encoded);

Ive tested my webserver and it i can log in via the firefox login prompt.

 

Please help.

 

Code snippet:

https://hastebin.com/coqaladoke.cs

Link to post
Share on other sites

7 minutes ago, WillLTT said:

--snip--

Did some further header searching & digging, HTTPUrlConnection does not support digest auth.

https://stackoverflow.com/questions/32689185/digest-authentication-in-android-using-httpurlconnection

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×