-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(improved-omniauth): omniauth sameWindow and inAppBrowser flows #323
feat(improved-omniauth): omniauth sameWindow and inAppBrowser flows #323
Conversation
9b5f51c
to
c867529
Compare
would this work for native android apps ? if yes can you please add details within the readme.. thanks |
@chirag7jain I think that it would work in a native android app. You would need to open the omniauth endpoint in an in-app browser and set the omniauth_window_type to 'inAppBrowser' (so something like The page that is rendered by your rails app will have a requestCredentials function. You will need to call that function from your native app to get the access token, client id, etc. In order to call that requestCredentials function, listen for the loadstop event fired by the inAppBrowser (the loadstop event exists when using the inAppBrowser plugin in cordova/phone gap. I assume it will exist for you as well). When the loadstop event fires, use executeScript to call requestCredentials() in that in-app browser window. The response will include all the info you need. Then close the in-app browser window and use the token, etc. in subsequent requests. It's not the easiest code to read, but you can see how ng-token-auth is doing this at the companion PR to this one: https://github.com/lynndylanhurley/ng-token-auth/pull/188/files Look for the methods requestCredentialsViaExecuteScript and handleLoadStop. Hopefully that makes some sense. Let me know how it goes. |
@ravi-ture please check this out |
a719390
to
74d291f
Compare
74d291f
to
1210000
Compare
1210000
to
e3e24b7
Compare
feat(improved-omniauth): omniauth sameWindow and inAppBrowser flows
@nbrustein how can I integrate it with facebook ios sdk? I already have the facebook token on my app, but now I need to login on my server (which already implements this gem with ng-token-auth). Is there a tutorial or something? Thanks |
Hey, |
Is there any news on this? Is it possible to login using iOS or android facebook SDKs and using the token to login to the rails server? |
This provides a mechanism to select between sameWindow (new default), newWindow (old default), or inAppBrowser modes for OAuth. This should allow for improved OAuth flows for a variety of use-cases, as well as supporting Cordova / PhoneGap implementations.
see also: lynndylanhurley/ng-token-auth#188 for ng-token-auth front-end implementation