My context: An AngularJS application using the Javascript Facebook SDK, and my distinct server (REST APIs).
Workflow:
User is logged in the client through the FB SDK using the method FB.login(callback)
.
This later gives a short-lived token that is then sent to the server in order to transform it to a long-lived token.
I'm interested in the mechanism of refreshing the long-lived token after 60 days.
So, reading the doc, we found this:
Even the long-lived access token will eventually expire. At any point, you can generate a new long-lived token by sending the person back to the login flow used by your web app - note that the person will not actually need to login again, they have already authorized your app, so they will immediately redirect back to your app from the login flow with a refreshed token - how this appears to the person will vary based on the type of login flow that you are using, for example if you are using the JavaScript SDK, this will take place in the background, if you are using a server-side flow, the browser will quickly redirect to the Login Dialog and then automatically and immediately back to your app again.
If I interpret it well, when user is ALREADY logged in through FB.login(callback)
, a simple redirect to the Angular Application's login flow would allow to get a new short-lived token.
I imagine that the FB.login
is immediately run anew in this case, without user interaction, as written.
I want to test it simply, so what I've done is:
- Logged in into the application through
FB.login(callback)
. - Clicked on a dummy link making a simple redirect with:
window.location.replace('/');
My application being a single page application, every URL should be considered as the authentication page.
But the FB.login
isn't run in the background, as I expected from the doc.
What would be the reason?
Does it work only when the domain making the redirect is distinct from the client? (I just can't test this case right now)
Did I misinterpret the doc?