lynndylanhurley / lynndylanhurley/devise_token_auth
dta_find_by doesn't respect request_keys
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 3.6k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
When posting issues, please include the following information to speed up the troubleshooting process:
- Version: master
We have devise setup with custom request keys
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, request_keys: [:email, :company_id]
only finds the first occurrence of rc instances, making login not working for our purposes.
If I try to override dta_find_by in the model I don't have access to request (where I store the current_company, nor to other attributes that could help me find the scoped user that wants to login.
Do you have any idea on how to solve this? Current attributes may help?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at app/controllers/devise_token_auth/concerns/set_user_by_token.rb around line 78 and inspect how dta_find_by selects a user during login. Reproduce the request_keys configuration with email and company_id, then confirm that login resolves the scoped user rather than only the first matching record.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100