Giter VIP home page Giter VIP logo

Comments (4)

lynndylanhurley avatar lynndylanhurley commented on July 23, 2024

Yikes!

  • Which versions of devise are you using?
  • Can you post the code that you're using to mount the routes?
  • Is there anything going on with devise / omniauth outside of this app that may be causing conflicts?

from devise_token_auth.

PeteMichaud avatar PeteMichaud commented on July 23, 2024

Hey Lynn:

Devise is 3.2.4
Routing code:

require 'sidekiq/web'

Gaia::Application.routes.draw do


  namespace :admin do
    mount Sidekiq::Web, at: '/queue'
  end

  constraints(id: Rails.application.config.uuid_regex) do
    namespace :api, defaults: {format: :json} do
      namespace :v1 do

        mount_devise_token_auth_for 'User', at: '/auth'

        resources :users, except: [:new, :edit], constraints: {id: /[a-z0-9-]+/} do
          resources :galleries, except: [:new, :edit]
        end

        get :'search/:q', controller: :search, action: :search

      end
    end
  end

  root to: 'home#index'

end

No conflicts that I can think of, this is a pretty new project that's bonehead basic right now, nothing really fancy going on.

from devise_token_auth.

lynndylanhurley avatar lynndylanhurley commented on July 23, 2024

Ok I think I see the problem. Devise doesn't seem to handle namespaces very well. Try removing this line from within the namespace blocks:

mount_devise_token_auth_for 'User', at: '/auth'

And then provide the entire namespace explicitly like this:

mount_devise_token_auth_for 'User', at: '/api/v1/auth'

So that the complete file looks like this:

require 'sidekiq/web'

Gaia::Application.routes.draw do

  mount_devise_token_auth_for 'User', at: '/api/v1/auth'

  namespace :admin do
    mount Sidekiq::Web, at: '/queue'
  end

  constraints(id: Rails.application.config.uuid_regex) do
    namespace :api, defaults: {format: :json} do
      namespace :v1 do

        resources :users, except: [:new, :edit], constraints: {id: /[a-z0-9-]+/} do
          resources :galleries, except: [:new, :edit]
        end

        get :'search/:q', controller: :search, action: :search

      end
    end
  end

  root to: 'home#index'

end

from devise_token_auth.

lynndylanhurley avatar lynndylanhurley commented on July 23, 2024

@PeteMichaud - if this works, let me know and I'll add a note in the README.

from devise_token_auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.