Skip to content
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

Using devise_token_auth and ng_token_auth with angularJS in an Ionic Hybrid application #218

Closed
sebastianzillessen opened this issue Apr 14, 2015 · 4 comments

Comments

@sebastianzillessen
Copy link

Hi there,

I want to implement a Hybrid application using ionic/cordova, angularjs and Ruby On Rails.

What do I have to do to get ng_token_auth working on a hybrid application?
I want to use the native Facebook SDK, how can I use this in the authentication progress?
How are accounts handled, that are created via Facebook or Email/password combination and are updated later to have the other login option as well (so e.g an account that was created via Email/Password connects to Facebook later and wants to use the login via Facebook after some time)?

Thanks for your help!

@jakubrohleder
Copy link
Contributor

Hi!

I'm using this game paired with ng_token_auth for some time for ionic application and the good news is, that it certainly does work.
The only problem I've encounter is solved by changing storage type to localStorage for android devices (or simply or devices), otherwise it wont work:

angular.module('myapp').config(function($authProvider) {
  $authProvider.configure({
    ...
    storage: 'localStorage'
  });
});

Unfortunatelly I do not have any experience with using it along with Outh2 SDKs.

@julianbei
Copy link

I have faced the same question with ionic apps.
Make sure to test the Facebook login on a few devices. Sometimes it is a bit terrible if you don´t open the facebook window in the Ionic InAppBrowser.
This topic has already been discussed in the community and there is a solution.
Actually there is a Cordova plugin for this problem:
http://ngcordova.com/docs/#Oauth
This is the Ionic Blogpost on this issue:
http://blog.ionic.io/oauth-ionic-ngcordova/

But your main question was to connect the accounts for already existing ones.
This question is a common question and has been answered several times on stackoverflow etc.
http://stackoverflow.com/questions/7837737/using-omniauth-to-facebook-connect-existing-user-with-different-permissions
http://stackoverflow.com/questions/21370461/connect-twitter-account-to-existing-devise-account
http://www.orhancanceylan.com/rails-twitter-and-facebook-authentications-with-omniauth-and-devise/

This is quite a comprehensive guide for this topic:
http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/

I hope that this solved your problem.

@booleanbetrayal
Copy link
Collaborator

@jakubrohleder - Do you have a PR or gist against devise_token_auth to implement Cordova support? Would like to get that methodology supported in this gem, in addition to the standard web OAuth flow.

@booleanbetrayal
Copy link
Collaborator

A changeset has been merged to support Cordova inAppBrowser flows. Version pushed as 0.1.33!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants