Quantcast
Channel: Spring Community Forums - Social
Viewing all articles
Browse latest Browse all 145

Facebook : How to "store" an accesstoken obtained via javascript in userconnection

$
0
0
I have an app that is accessed both via web and via phonegap.

When using the web, I am using the spring social framework (i.e doing a post on /provider/facebook).
So the userconnection table is updated.

In phonegap, I use a plugin to use the native facebook sdk (https://github.com/mgcrea/cordova-facebook-connect)
Then I send the token to the server so that I can do the auth :
FacebookTemplate fb = new FacebookTemplate(facebookAccessToken);
FacebookProfile p = api.userOperations().getUserProfile();
FfUser u = userDao.loadByEmail(p.getEmail());

The problem when I do this is that I am "bypassing" spring social.

So later (i.e in another request) when I do :
Facebook facebook = conRepo.createConnectionRepository(searcher.getId( )).getPrimaryConnection(Facebook.class).getApi();
List<FbFriend> friends = facebook.fetchConnections("me", "friends", FacebookFriends.FbFriend.class, "name", "installed");

I have a ExpiredAuthorizationException (because I am using the token obtained via the web and now only the token obtained via JS is valid).

So my question is : how do I update the userconnection when I am not using the ProviderSignInController ?

I've studied the code of ProviderSignInController but it goes beyond my understanding where should I plug since I've already consumed the oauth2 workflow ...

Any help really appreciated !

Viewing all articles
Browse latest Browse all 145

Trending Articles