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

NoMethodError: undefined method `provider' for #<User #1063

Closed
shivabhusal opened this issue Jan 12, 2018 · 2 comments
Closed

NoMethodError: undefined method `provider' for #<User #1063

shivabhusal opened this issue Jan 12, 2018 · 2 comments

Comments

@shivabhusal
Copy link

I am facing this error

 > a=User.create
   (3.0ms)  BEGIN
   (0.1ms)  ROLLBACK
NoMethodError: undefined method `provider' for #<User:0x0000000008433390>

I don't have uid and provider fields in users table. However, I have moved these fields to auth_identities table.

can I make devise_token_auth not to search for the fields uid, provider?

@zachfeldman
Copy link
Contributor

You could but you'd have to modify the library extensively. This is default behavior.

@omarosama89
Copy link

omarosama89 commented Dec 27, 2022

@shivabhusal Yeah you can.

  1. in config/initializers/devise_token_auth.rb uncomment this line and make it false
  config.change_headers_on_each_request = false
  1. search for config.other_uid and set it to whatever field you want.
  2. Add this method to your model
def provider
  "custom_attr"
end

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

3 participants