You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In certain cases, such as the one presented, this check fails to work as intended because the client instance is of type Doorkeeper::Application. This is due to the behavior of grant.application returning a Doorkeeper::Application instance instead of Doorkeeper.config.application_class.to_s, despite the AccessGrant relationship being correctly defined as shown below:
giovannelli
changed the title
Issue with Defining application_class in Doorkeeper Config Causing NoMethodError
Issue with defining application_class in Doorkeeper config causing NoMethodError
Aug 30, 2023
Issue
When defining the
application_class
in the Doorkeeper configuration, an error is encountered:NoMethodError: undefined method `application' for #<Doorkeeper::Application id:...
The issue arises in the
AuthorizationCodeRequest
during the execution of thebefore_successful_response
method.The problem appears to stem from the following code block in the base_request:
In certain cases, such as the one presented, this check fails to work as intended because the client instance is of type
Doorkeeper::Application
. This is due to the behavior ofgrant.application
returning aDoorkeeper::Application
instance instead ofDoorkeeper.config.application_class.to_s
, despite the AccessGrant relationship being correctly defined as shown below:To address this issue, a potential solution is to modify the
AuthorizationCodeRequest.before_successful_response
method as follows:By passing client directly, similar to how it's done for other types of requests, the issue might be resolved.
Please share your thoughts on whether the proposed solution appears reasonable or if there are any crucial aspects that I may have overlooked.
System configuration
Doorkeeper Version: latest
Ruby Version: 3.2.2
Rails Version: 7.0.7.2
Doorkeeper initializer:
The text was updated successfully, but these errors were encountered: