0

How do I implement oauth 2.0 in Android? I was able to obtain a token but

https://api.linkedin.com/v1/people/~:(email-address,first-name,last-name)?oauth2_access_token=

was not able to verify it. How do I send my client id as parameter? I used the following code to authenticate.

LISessionManager.getInstance(getApplicationContext()).init(this, buildScope(), new AuthListener() {
            @Override
            public void onAuthSuccess() {
                LISessionManager liSessionManager = LISessionManager.getInstance(getApplicationContext());
                handleLinkedIn(liSessionManager);
                Log.d( "success", LISessionManager.getInstance(getApplicationContext()).getSession().getAccessToken().toString());
            }
            @Override
            public void onAuthError(LIAuthError error) {
                Toast.makeText(getApplicationContext(), "failed " + error.toString(), Toast.LENGTH_LONG).show();
            }
        }, true);

I used this method to obtain the access token.

LISessionManager.getInstance(getApplicationContext()).getSession().getAccessToken().toString()
Ajeet Choudhary
  • 1,969
  • 1
  • 17
  • 41
meow2x
  • 2,056
  • 22
  • 27

1 Answers1

1

That is not the correct access token that you are sending. See this example get access token from linkedIn

Ajeet Choudhary
  • 1,969
  • 1
  • 17
  • 41
  • Thanks, I tried it and it worked. So the only way to get the correct access token is through a webview? There is no method from the sdk that can do that? – meow2x Jun 21 '17 at 02:56
  • 1
    Right, access token that you get from sdk did not verify you on server(Linked server) for authorization you need to get it from web :) – Ajeet Choudhary Jun 21 '17 at 04:47