hamtory / socialauth-android

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

Need a guide to use access tokens #127

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hey guys first of all I would like to thank you so much for such an amazing API.

Now here's my problem,
I'm currently developing an app/service which saves the authentication/access 
token from providers and saves it in server backend for future use.

Eg: 
1.User logs into custom service, 
2.authenticates with facebook, 

then i wanna save this authentication status in my backend so that next time if 
the user logs into custom service he needn't authenticate facebook again.

I learned that you can get access token through the following code:
adapter.getcurrentprovider().getAccessGrant().getKey()

But how to use it to avoid provider reauthentication??

Please help I've searched a lot, getting a real headache now.

Thanks in advance.

Original issue reported on code.google.com by blooshaa...@gmail.com on 14 Nov 2013 at 4:19

GoogleCodeExporter commented 9 years ago
Sorry to spam, didn't mean to Enter the type as DEFECT

Original comment by blooshaa...@gmail.com on 14 Nov 2013 at 4:23

GoogleCodeExporter commented 9 years ago
Am using the official facebook api and this is built in. Want to switch over to 
this api, but need to kleep the
access token alive....

Original comment by aja...@gmail.com on 21 Nov 2013 at 7:13

GoogleCodeExporter commented 9 years ago
blooshaanster

next time, the app will use the access token to log to facebook. I don't think 
you need to do anything.

if you want to create custom methods you can use api method.

ajanks, we may switch to official facebook api in next release but currently 
not confirm.
currently we don't use office facebook api , so can't use access token.

Original comment by vineet.a...@3pillarglobal.com on 21 Nov 2013 at 9:35

GoogleCodeExporter commented 9 years ago
No suppose the user has logged out from the service completely and he logs in 
back again from a different device. Then he has to log in to facebook again 
right? thats what i want to avoid.

Instead if I'm able to save access token, then the user will be relieved of 
re-login, hope u got it.

And how to log-out from providers using SocialAuth?!! having trouble with the 
arguments, where's the documentation guys?!  

Original comment by blooshaa...@gmail.com on 22 Nov 2013 at 3:40

GoogleCodeExporter commented 9 years ago
In socialauth , we use accessGrant that contains key, secret , permissions.

what you can do that you save ( if i m understanding your use case) the 
AccessGrant Object and re-use it on different device.

One thing you must take care, the user should not log through socialauth again 
because this token will get invalid if you generate a new access token.

Please note we are not handling the expiry token state as this is a common lib.

Original comment by vineet.a...@3pillarglobal.com on 2 Dec 2013 at 9:20

GoogleCodeExporter commented 9 years ago

Original comment by vineet.a...@3pillarglobal.com on 2 Dec 2013 at 9:21

GoogleCodeExporter commented 9 years ago
ok but where can i get this access Grant object? the source is in jar, is there 
any api or do i have to modify it myself?

If i have to modify it myself then where is the source for latest socialauth 
jar?

Thank you for responding.

Original comment by blooshaa...@gmail.com on 5 Dec 2013 at 6:48

GoogleCodeExporter commented 9 years ago
Hey I figured out a way to get the access grant object but how should i reuse 
it?
I know i cant call adapter.authorize cuz it will replace the token. then where 
should i pass this access grant object?

ANOTHER ISSUE regarding GOOGLE PLUS. I'm using my own client id & secret but 
I'm unable to login cuz there's a callback uri mismatch. 

I manually updated the callback uri with the uri mentioned in Google Cloud 
Console but then the webview wont redirect back to application after GOOGLE 
PLUS AUTHENTICATION. 

Original comment by blooshaa...@gmail.com on 5 Dec 2013 at 6:54

GoogleCodeExporter commented 9 years ago
Thank you, everything is working awesome now! :)

Original comment by blooshaa...@gmail.com on 27 Dec 2013 at 8:37

GoogleCodeExporter commented 9 years ago
Guys issue resolved :)

Original comment by blooshaa...@gmail.com on 27 Dec 2013 at 8:41

GoogleCodeExporter commented 9 years ago

Original comment by vineet.a...@3pillarglobal.com on 14 Jan 2014 at 1:04

GoogleCodeExporter commented 9 years ago
blooshaa...@gmail.com
Are you able to post your solution to re-using the AccessGrant object?

Original comment by blair.an...@gmail.com on 22 Mar 2014 at 6:47

GoogleCodeExporter commented 9 years ago
Ok , I will soon post an article for using the access grant object. and will 
update on thread.

Original comment by l...@3pillarglobal.com on 24 Mar 2014 at 7:34

GoogleCodeExporter commented 9 years ago
Please tell me the method of reusing access grant. I am in a keen and urgent 
need of it

Original comment by darrs...@gmail.com on 1 Apr 2014 at 4:40

GoogleCodeExporter commented 9 years ago
use adapter.getCurrentProvider().getAccessGrant()

will soon create a doc.

Original comment by vineet.a...@3pillarglobal.com on 2 Apr 2014 at 7:46