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

Possible to use Google oauth2 with devise_token_auth as well as devise? #1619

Open
reisner opened this issue Apr 16, 2024 · 0 comments
Open

Comments

@reisner
Copy link

reisner commented Apr 16, 2024

Hi there,

I've got a web app that also functions as an API for a mobile app. Devise is used for the user login, and devise_token_auth for the mobile app login. This is working fine for database users, however I cant get it working for google oauth2.

When I try to use google oauth2 via devise_token_auth, I set config.omniauth_prefix. However, this seems to overwrite the path for omniauth callbacks for base devise. I believe i need to have two separate endpoints for omniauth via devise_token_auth and for devise. Is that true? Is it possible to have both working at the same time?

Settings:

  devise_for :users, controllers: {
    omniauth_callbacks: 'users/omniauth_callbacks',
    sessions: 'users/sessions',
    registrations: 'users/registrations'
  }

  namespace :api do
    namespace :v1 do
      mount_devise_token_auth_for 'User', at: 'auth', defaults: {format: 'json'}
    end
  end

Versions:
devise_token_auth (1.2.2)
rails (7.1.3.2)
devise (~> 4.9)
ruby 3.2.3p157

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

1 participant