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

Allow client_credentials flow #13

Open
szechyjs opened this issue Feb 10, 2019 · 1 comment
Open

Allow client_credentials flow #13

szechyjs opened this issue Feb 10, 2019 · 1 comment

Comments

@szechyjs
Copy link

szechyjs commented Feb 10, 2019

When authenticating using client_credentials flow resource_owner_id is nil. This results in the following exception.

ActiveRecord::RecordNotFound (Couldn't find User without an ID):

activerecord (5.2.1) lib/active_record/relation/finder_methods.rb:429:in `find_with_ids'
activerecord (5.2.1) lib/active_record/relation/finder_methods.rb:69:in `find'
activerecord (5.2.1) lib/active_record/querying.rb:5:in `find'
activerecord (5.2.1) lib/active_record/core.rb:167:in `find'
devise-doorkeeper (1.1.2) lib/devise/strategies/doorkeeper.rb:48:in `resource_from_token'
devise-doorkeeper (1.1.2) lib/devise/strategies/doorkeeper.rb:17:in `authenticate!'
warden (1.2.7) lib/warden/strategies/base.rb:54:in `_run!'
warden (1.2.7) lib/warden/proxy.rb:359:in `block in _run_strategies_for'
warden (1.2.7) lib/warden/proxy.rb:354:in `each'
warden (1.2.7) lib/warden/proxy.rb:354:in `_run_strategies_for'
warden (1.2.7) lib/warden/proxy.rb:324:in `_perform_authentication'
warden (1.2.7) lib/warden/proxy.rb:128:in `authenticate!'
devise (4.5.0) lib/devise/controllers/helpers.rb:118:in `authenticate_user!'

https://github.com/betterup/devise-doorkeeper/blob/master/lib/devise/strategies/doorkeeper.rb#L48

Edit: even if I don't use authenticate_user on a controller ActiveRecord::RecordNotFound (Couldn't find User without an ID) is thrown when using client_credentials. The only way around it is to remove :doorkeeper from the devise config in the User model.

@zousu
Copy link

zousu commented Jul 20, 2020

Allow client_credentials flow and optional scopes
#16

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

2 participants