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

Add missing method to token response #1696

Merged

Conversation

fredplante
Copy link
Contributor

@fredplante fredplante commented Mar 9, 2024

Summary

Doorkeeper::OAuth::TokenResponse should respond to :issued_token, as Doorkeeper::OAuth::CodeResponse does.

From the initializer:

# after_successful_authorization do |controller, context|
# controller.session[:logout_urls] <<
# Doorkeeper::Application
# .find_by(controller.request.params.slice(:redirect_uri))
# .logout_uri
#
# Rails.logger.info(context.auth.inspect)
# Rails.logger.info(context.issued_token)
# end

So if you implement some code in the after_successful_authorization hook, you should be able to use #issued_token regardless of the grant flow used. If you add the suggested logging code from the doc, an exception will be raised if you use client_credential grant flow.

Copy link
Member

@nbulaj nbulaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, thanks! 👍

Can you please add a changelog entry?

@fredplante fredplante requested a review from nbulaj March 11, 2024 08:20
@nbulaj nbulaj merged commit 9c87e5a into doorkeeper-gem:main Mar 11, 2024
20 checks passed
@nbulaj
Copy link
Member

nbulaj commented Mar 11, 2024

Thanks @fredplante 🙇

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

Successfully merging this pull request may close these issues.

2 participants