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

Devise Omniauth and DeviseTokenAuth Omniauth #666

Closed
dtelaroli opened this issue Jun 23, 2016 · 8 comments
Closed

Devise Omniauth and DeviseTokenAuth Omniauth #666

dtelaroli opened this issue Jun 23, 2016 · 8 comments

Comments

@dtelaroli
Copy link

Is it possible use two way of authentication (devise and devise_token_auth)?

I'm trying but the devise omniauth uses same api path and the redirection (/omniauth/:provider/callback), and after redirect goes to api path with error (Could not authenticate you from Facebook because "Csrf detected".).

My route configuration:

devise_for :users
  namespace :api do
    scope :v1 do
      mount_devise_token_auth_for 'User', at: 'auth'
  end

In separated apps both works fine.

@poc7667
Copy link

poc7667 commented Jun 27, 2016

Try this on your application_controller

protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format.json? }

@dtelaroli
Copy link
Author

dtelaroli commented Jun 27, 2016

I've created a new application to test it.
I need now create two way of authentication.

  1. Sign In/Up with Facebook and Devise (Rails)
  2. Sign In/Up with Facebook and Devise Token Auth (Ionic App)

The step 1 works as well, but the step 2 uses same callback fase, and redirect to root_path like the step 1.
How can I configure different callback to Devise Token Auth?

Now my route is:

  devise_for :users, controllers: {omniauth_callbacks: 'callbacks'}
  namespace :api do
    scope :v1 do
      mount_devise_token_auth_for 'User', at: 'auth'
      as :user do
        resources :index
      end
    end
  end
  resources :home

Note: I needed repeat the devise configuration to work (before and after).

devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :omniauthable, :omniauth_providers => [:facebook]
  include DeviseTokenAuth::Concerns::User
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :omniauthable, :omniauth_providers => [:facebook]

@dtelaroli
Copy link
Author

dtelaroli commented Jun 28, 2016

I started new blank application to try solve it.
I configured devise and now I have problem with devise_token_auth.
In callback fase, both responses pass thought in the devise callback. I don't know how can I separate it or to identify who start the authentication.

@macchie
Copy link

macchie commented Aug 30, 2016

Any progress with this?

@steverob
Copy link

Any progress in this? :)

@sebfie
Copy link

sebfie commented Sep 26, 2016

I also need this!

@zachfeldman
Copy link
Contributor

Hi there @dtelaroli ,

In an effort to cleanup this project and prioritize a bit, we're marking issues that haven't had any activity in a while with a "close-in-7-days" label. If we don't hear from you in about a week, we'll be closing this issue. Obviously feel free to re-open it at any time if it's the right time or this was done in error!

If you are still having the issue (especially if it's a bug report) please refer to our new Issue Template to provide some more details to help us solve it.

Hope all is well.

@dtelaroli
Copy link
Author

I did'nt saw this before, but, I give up this plugin because it has a lot of bugs and incompatibilities for me with no help.
Thanks.

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

No branches or pull requests

6 participants