solved Basic Authentication

nate
@nate
9 years ago
917 posts
Forgive my greeness. Proxima says use the client key as the username. The tutorial I have for android basic auth says use a hash with the password and username.

AndroidHttpClient client = AndroidHttpClient.newInstance("AndroidAgent");
HttpGet request = new HttpGet(uri);
String credentials = username + ":" + password;
String base64EncodedCredentials = Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
request.addHeader("Authorization", "Basic " + base64EncodedCredentials);
HttpResponse response;


Do I drop the password?

updated by @nate: 02/20/15 07:10:54PM
nate
@nate
9 years ago
917 posts
I'm gonna go with yes.

String credentials = ClientMap.PROXIMA_KEY;

updated by @nate: 01/19/15 10:38:08AM
brian
@brian
9 years ago
10,148 posts
No - look on Line 3 - you can see the "username" and "password" are concatenated together to form one string:

String credentials = username + ":" + password;


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
nate
@nate
9 years ago
917 posts
If the client key is the username what is the password?
brian
@brian
9 years ago
10,148 posts
Natedogg265:
If the client key is the username what is the password?

No - the App ID is the username, the client key is the password.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
nate
@nate
9 years ago
917 posts
I see.
nate
@nate
9 years ago
917 posts
{"code":404,"text":"Not Found","note":"application not found"}

Does this mean my above authentication is failing?
brian
@brian
9 years ago
10,148 posts
No - it means the App ID you are using is incorrect - so for Basic Authentication here you want to use the Client Key for BOTH username and password. (I had to look at that in the code since I had not looked at it in a long time).


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
nate
@nate
9 years ago
917 posts
I'm in!!!!!!

Boy, is this a load off my mind. I've been really frustrated. I wanna get to the point where I'm not doing things for the first time all the time.
nate
@nate
9 years ago
917 posts
Final question on this. When I switch to session id, do I do the same? Use it for the username and password? Or do I switch to app name?
brian
@brian
9 years ago
10,148 posts
Natedogg265:
Final question on this. When I switch to session id, do I do the same? Use it for the username and password? Or do I switch to app name?

You still use the client id - so

username = client id
password = session id


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
nate
@nate
9 years ago
917 posts
Thanks for your patience, B.
brian
@brian
9 years ago
10,148 posts
Natedogg265:
Thanks for your patience, B.

No problem!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags