Skip to content

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

Open
@reisner

Description

@reisner

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions