Closed
Description
See my comment in the NoMethodError
handler
# `access_token_mixin.rb`
def generate_token
self.created_at ||= Time.now.utc
generator = Doorkeeper.configuration.access_token_generator.constantize
self.token = generator.generate(
resource_owner_id: resource_owner_id,
scopes: scopes,
application: application,
expires_in: expires_in,
created_at: created_at
)
rescue NoMethodError
# Doorkeeper::JWT was trying to use `[]` on a null variable and thus a NoMethodError was raised. The error message returned here in this case was misleading because Doorkeeper::JWT does in fact respond to `.generate`
raise Errors::UnableToGenerateToken, "#{generator} does not respond to `.generate`."
rescue NameError
raise Errors::TokenGeneratorNotFound, "#{generator} not found"
end
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
[]
doorkeeper-gem/doorkeeper-jwt#14anthonylebrun commentedon Jun 2, 2017
I believe I had just had this happen to me. I think the solution may be to use a throw a custom exception rather than use NoMethodError and explicitly check via respond_to?(:generate). Happy to do a PR if I get the green light.
Charizard commentedon Oct 5, 2017
Same here 👍
Fix doorkeeper-gem#943: proper Access Token value generation