meteor icon indicating copy to clipboard operation
meteor copied to clipboard

Facebook OAuth refresh token flow

Open avital opened this issue 14 years ago • 14 comments

Meteor currently reads an access token from an oauth provider, for example Facebook, when logging in, and stores this on user.services.facebook.accessToken. The access token is used on subsequent HTTP calls to Facebook, for example when the app wants to act on behalf of the user. This isn't sufficient:

  1. If a user logs into a Meteor app using Facebook, and then logs out of Facebook (but not out of the Meteor app), and that Meteor app uses the accessToken to act on behalf of the user, that won't work.
  2. The app developer can work around this by implementing the access token refresh logic themselves (since they'll be doing the HTTP call to Facebook themselves directly anyways)
  3. Meteor could make this experience better by supplying a wrapper around HTTP calls to facebook that use the access token, which would also refresh it as needed. This way the app developer doesn't have to think about this at all.

avital avatar Nov 01 '12 04:11 avital

https://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/

avital avatar Nov 01 '12 14:11 avital

original discussion thread: https://groups.google.com/forum/?fromgroups=#!topic/meteor-talk/piWqeSyG4LI

avital avatar Nov 16 '12 00:11 avital

Please add google support.

nwmartin avatar Nov 16 '12 17:11 nwmartin

I'll look into this if you like. I need this anyway. I like the wrapper idea.

scottburch avatar Nov 16 '12 18:11 scottburch

That would be awesome! On Nov 16, 2012 10:25 AM, "Scott Burch" [email protected] wrote:

I'll look into this if you like. I need this anyway. I like the wrapper idea.

— Reply to this email directly or view it on GitHubhttps://github.com/meteor/meteor/issues/444#issuecomment-10456643.

avital avatar Nov 16 '12 18:11 avital

On it.

scottburch avatar Nov 17 '12 01:11 scottburch

@scottburch has some sample code of a HTTP wrapper that refreshes tokens for OAuth on another issue: https://github.com/meteor/meteor/pull/464#issuecomment-10502154. Thanks, Scott!

avital avatar Nov 20 '12 19:11 avital

I believe this is a Pull Request trying to address this issue for Google accounts: https://github.com/meteor/meteor/pull/495

avital avatar Nov 20 '12 19:11 avital

Is there any recent news on this?

joscha avatar Dec 03 '12 06:12 joscha

Before thanksgiving there was some activity in merging the dependent pull request, but no activity that I have seen since then. You can merge in our branches and it seems to work fine.

I would like to see this move forward because I am currently merging the meteor branches into mine to keep my project working.

scottburch avatar Dec 03 '12 06:12 scottburch

Is there any way I can apply this on an existing 0.5.2 meteor?

joscha avatar Dec 03 '12 16:12 joscha

Sorry for the delay. I'll get #464 which this is dependent on merged in today.

On Mon, Dec 3, 2012 at 8:45 AM, Joscha Feth [email protected]:

Is there any way I can apply this on an existing 0.5.2 meteor?

— Reply to this email directly or view it on GitHubhttps://github.com/meteor/meteor/issues/444#issuecomment-10960711.

avital avatar Dec 03 '12 19:12 avital

This issue has had its name changed several times and a lot of the functionality referred to in comments above has been implemented. What's left is the stuff described in this blog post:

https://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/

gschmidt avatar Feb 06 '13 23:02 gschmidt

Both Facebook's manual Oauth flow and Meteor's facebook-oauth package have changed quite a bit since this issue was opened. There has been no activity/interest in this issue in 4+ years, so the time has come to close it off. Thanks all!

hwillson avatar Mar 09 '17 19:03 hwillson