Nikunjpatel890 / socialauth

Automatically exported from code.google.com/p/socialauth
0 stars 0 forks source link

No easy to way to check for access token #340

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi I am using latest version of social auth for server and for Android.

I have this segment of source code on server side (in Scala):

socialAuthConfig.load(inputStreamOption.get)

          val socialAuthManager = new SocialAuthManager

          socialAuthManager.setSocialAuthConfig(socialAuthConfig)

          val providerId = "linkedin"

          val linkedinAccessToken = "36cc6f17-a8e3-4dab-8438-575cf6cdc8a0"

          //val accessGrant = socialAuthManager.createAccessGrant(providerId, linkedinAccessToken, "")
          val provider_config = socialAuthConfig.getProviderConfig(providerId)

          val accessGrant = new AccessGrant(linkedinAccessToken, provider_config.get_consumerSecret())

          //val authProvider = socialAuthManager.getProvider(providerId)

        val authProvider = new LinkedInImpl()

          authProvider.getProviderId

          //Option(authProvider) must beNone

I have not mastered all the differences between consumer key, consumer secret, 
api key, api secret, access token. And also there is some confusion about them.

My main goal is simply to force an access token (which I have already retrieve 
from another source) and verify in server if this is correct.

In other words I believe a method like this one would be really useful:
socialAuthManager.verifyAccessToken(providerId: String, accessToken: String)

Thank you

Original issue reported on code.google.com by pligor.g...@gmail.com on 30 Apr 2014 at 11:17

GoogleCodeExporter commented 8 years ago
More people seem to have similar issues: 
http://stackoverflow.com/questions/22776780/how-to-get-and-reuse-access-token-in
-social-auth-android

Original comment by pligor.g...@gmail.com on 30 Apr 2014 at 11:54

GoogleCodeExporter commented 8 years ago
Please try follwing:-

 val socialAuthManager = new SocialAuthManager

          socialAuthManager.setSocialAuthConfig(socialAuthConfig)

          val providerId = "linkedin"

          val linkedinAccessToken = "36cc6f17-a8e3-4dab-8438-575cf6cdc8a0"
val accessGrant = new AccessGrant();
accessGrant.setKey(linkedinAccessToken);
accessGrant.setProviderId(providerId);

AuthProvider provider = socialAuthManager.connect(accessGrant);

Profile profile = provider.getUserProfile();

Original comment by tarun.na...@3pillarglobal.com on 1 May 2014 at 5:25

GoogleCodeExporter commented 8 years ago
Is it working for you?

Original comment by tarun.na...@3pillarglobal.com on 15 May 2014 at 4:21

GoogleCodeExporter commented 8 years ago
Hi,

I'm using the latest version of the library for Android.

How can I obtain access token that I can reuse in the backend server?

Currently I'm using following code to get it:
                AuthProvider provider = social_auth_adapter.getCurrentProvider();
                if(provider!=null)
                    linkedInToken = provider.getAccessGrant().getKey();

Then I want to use it on my PHP backend to retrieve user's LinkedIn profile, 
but I get "401 invalid access token" error.

Original comment by marcin.n...@gmail.com on 20 May 2014 at 10:17

GoogleCodeExporter commented 8 years ago
If you are still facing this issue, please post it on 
https://code.google.com/p/socialauth-android/

Original comment by tarunnag...@gmail.com on 31 Oct 2014 at 1:46