Using stormpath web login, once a User has been authenticated, the currently logged in user Account is available on subsequent requests and can be retrieved by doing the following (e.g from within a Servlet) ;
Account account = AccountResolver.INSTANCE.getAccount(request);
where request
is HttpServletRequest
Now, what i need to know is, why is it not possible to do the same thing for a socially signed in user (i.e a user that signs in with google, facebook, linked-in)???
I know that on sign-up/sign-in, the Account can be retrieved by doing the following;
String applicationHref = appHref;
String code = request.getParameter("code");
Application application = client.getResource(appHref, Application.class);
ProviderAccountRequest request = Providers.GOOGLE.account()
.setCode(code)
.build();
ProviderAccountResult result = application.getAccount(request);
Account account = result.getAccount();
But afterwards, doing Account account = AccountResolver.INSTANCE.getAccount(request);
always returns null
.
Now this is a problem because code
is only available on sign in and not for subsequent requests hence using the snippet above is not possible. Besides, it seems like too much work for everytime the currently loggedin Account has to be fetched.
I've endlessly browsed the Stormpath documentation and found no leads... Any ideas would be highly appreciated.
Thanks.