Authentication for GET request in Android HTTP / 1.1 406 Not allowed

I tried, but there seems to be a problem in creating a GET request for an example hero URL " https://xxxx-xxxxx.herokuapp.com/xxxxxx/xxxxxxxx "

I know the general method

HttpClient client = factory.getHttpClient(); //or any method to get a client instance Credentials credentials = new UsernamePasswordCredentials(username, password); client.getState().setCredentials(AuthScope.ANY, credentials);

And I know that getState () is not available for version 3.x.

I don’t know how the Chrome "Advance REST Client" handler handled it, it gave me a popup and asked for my username and password, and I entered the credentials and it worked, and it has been working fine ever since. I thought he could store credentials locally, but that is not the case. I checked all cookies and cache. I deleted the extension and cleared the data and still worked.

Then I tried to use another REST client using WizTools (for Mac). In the "Authorization" section there are 3 options. 1.) Basic, 2.) Digest and 3.) Preemptive, I did some permutation and combination with it using Credentials data, but all the time it gave the same answer ie

"HTTP / 1.1 406 is not valid"

I do not understand what the problem is?

Thanks,

+4
source share
1 answer

I don't know why this does not work, but I used URLConnecton using the authentication mentioned, and it worked. I got an answer. And yes, BTW I had to set the type to "Accept" s "Application / Json"

+5
source

All Articles