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

Wrong model mapped for token_validation #820

Closed
noopurj opened this issue Jan 25, 2017 · 1 comment
Closed

Wrong model mapped for token_validation #820

noopurj opened this issue Jan 25, 2017 · 1 comment

Comments

@noopurj
Copy link

noopurj commented Jan 25, 2017

This is somewhat similar to #399 but it was closed without any solution.
I have a 'Worker' and 'User' model. I am using standard devise for User, and devise_token_auth and standard devise for 'Worker'

routes.rb

  devise_for :users
  devise_for :workers

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

Worker model includes DeviseTokenAuth::Concerns::User and it has all the columns required for devise_token_auth to work and the base controller for the api includes DeviseTokenAuth::Concerns::SetUserByToken

/api/auth/sign_in works perfectly
however /api/auth/validate_token fails throwing a undefined method 'find_by_uid' error.

in live console,
app/controllers/devise_token_auth/concerns/set_user_by_token.rb
user = uid && rc.find_by_uid(uid)

rc returns User when it should be Worker. mapping returns :user
Is there anything I have left out in configuring devise_token_auth for the Worker model?

@zachfeldman
Copy link
Contributor

Hi there @noopurj ,

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.

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

2 participants