lynndylanhurley / lynndylanhurley/devise_token_auth

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

Open
#1,619 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing the devise_for :users routes, the api/v1 mount_devise_token_auth_for configuration, and config.omniauth_prefix to understand how both callback paths are generated. Done means establishing whether separate Google OAuth callbacks can coexist and documenting or implementing the supported configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, authentication
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.