meteor-useraccounts / core

Meteor sign up and sign in templates' core functionalities
http://useraccounts.meteor.com/
MIT License
529 stars 281 forks source link

OAuth popup vs redirect flow - useraccounts support ? #163

Closed nunohvidal closed 9 years ago

nunohvidal commented 9 years ago

Hi Luca,

I've been having some issues with my app using the social login buttons when running on a meteor cordova build on android From here OAuth-for-mobile-Meteor-clients

Usually, the popup-based flow is preferable because the user will not have to reload your whole app at the end of the login flow. However, the popup-based flow requires browser features such as window.close and window.opener that are not available in all mobile environments. In particular, we recommend using Meteor.loginWith<ExternalService>({ loginStyle: "redirect" }) in the following environments:

  • Inside UIWebViews (when your app is loaded inside a mobile app)
  • In Safari on iOS8 (window.close is not supported due to a bug)

Is this something that meteor-useraccounts supports at the moment?

Thank you, Nuno

splendido commented 9 years ago

Hello Nuno!

No, at the moment this is not supported but it will be ab easy add.

Just adding another configuration parameter should be enough to be able to switch from the normal call without parameters to the one you reported above.

What would you suggest for the parameter name? Do you think socialLoginStyle with allowed values popup and redirect would be fine?

splendido commented 9 years ago

I've had a very quick look at the OAuth calls and it seems that all ends up here where it seems that the 'Cordova' detection is already in place and forces to return 'popup'.

I'm not sure adding the loginStyle option would be enough...

Thoughts?

nunohvidal commented 9 years ago

That was great investigation on how Meteor handles OAuth flow - i'll run some tests and let you know where I can get and let you know.

Thank you.

On 20 November 2014 07:42, Luca Mussi notifications@github.com wrote:

I've had a very quick look at the OAuth calls and it seems that all ends up here https://github.com/meteor/meteor/blob/ccfee68145720cd7761680215125f3f005d9ed30/packages/oauth/oauth_client.js#L15 where it seems that the 'Cordova' detection is already in place and forces to return 'popup'.

I'm not sure adding the loginStyle option would be enough...

Thoughts?

— Reply to this email directly or view it on GitHub https://github.com/meteor-useraccounts/core/issues/163#issuecomment-63771598 .

Nuno Vidal

splendido commented 9 years ago

Not sure whether it might help solve your issue but it was correct to leave the possibility to specify the login style!

See socialLoginStyle among the configuration options.

Tnx!