yubrajpokharel/socialauth

How to retrieve access token to make Facebook connection

Closed this issue · 6 comments

What steps will reproduce the problem?
1.Able to redirect to provider url and come back to our url. 
2. Inorder to post on the user's wall we need access_token.
3. How can we retrieve this token using the sdk

What is the expected output? What do you see instead?
Need to post of authenticated user's wall

What version of the product are you using? On what operating system?
Windows 8

Please provide any additional information below.
Saw a link to do the same in .net. How to do this with java. 
https://code.google.com/p/socialauth-net/wiki/FAQs

Original issue reported on code.google.com by sudham...@gmail.com on 26 Sep 2013 at 1:15

I hope on return url you are making a call like this

AuthProvider provider = manager.connect(paramsMap);

and getting above manager from session.

After that you can make a function call 
provider.updateStatus(statusMessage 

If you want to save token you can call provider.getAccessGrant() and save this 
object. You can use it later.

Original comment by tarun.na...@3pillarglobal.com on 27 Sep 2013 at 2:39

Hi Can you give me a method to save a post on facebook wall. I am looking at 
something that will let me upload a image like our company icon with links and 
something that will set the privacey to self

Original comment by sudham...@gmail.com on 28 Sep 2013 at 10:33

I have already used updateStatus but we are looking at
1. com.restfb.DefaultFacebookClient(oauth_token).publish("me/feed", 
FacebookType.class, Parameter.with("name",""), Parameter.with("caption","" ), 
Parameter.with("picture", ""),Parameter.with("message",""), 
Parameter.with("privacy", "{'value' : 'CUSTOM','friends':'SELF'}"));

2. How can I get the oauth_token with socialauth?


Original comment by sudham...@gmail.com on 29 Sep 2013 at 5:07

You can call
AuthProvider provider = manager.connect(paramsMap);
AccessGrant ag =  provider.getAccessGrant();
String oauth_token = ag.getKey(); //here you'll get access token.

You can also upload image with socialauth using provider.uploadImage()

Regards
Tarun

Original comment by tarun.na...@3pillarglobal.com on 1 Oct 2013 at 2:29

Closing the issue.

Original comment by tarun.na...@3pillarglobal.com on 15 Oct 2013 at 12:14

  • Changed state: Done
what is paramsMap and manager in this 

Original comment by ldsing...@gmail.com on 16 Feb 2015 at 5:36