ruby-on-railsrubydoorkeeper

Doorkeeper 5.4.0 ArgumentError


I recently updated my app, from doorkeeper 5.3.3 to 5.4.0 but changes to Doorkeeper::AccessToken.find_or_create_for were made apparently, but I can't find anything in the CHANGELOG

so

@access_token = Doorkeeper::AccessToken.find_or_create_for(
  oauth_client,
  model.user.id,
  oauth_scopes,
  oauth_expiry_time,
  oauth_server.refresh_token_enabled?
)

returns now an ArgumentError

ArgumentError (wrong number of arguments (given 5, expected 0; required keywords: application, resource_owner, scopes)):

Has this also happened to anybody else?


Solution

  • Doorkeeper::AccessToken.find_or_create_for seems to expects keyword arguments instead of a simple list of arguments nowadays.

    @access_token = Doorkeeper::AccessToken.find_or_create_for(
      application:       oauth_client,
      resource_owner:    model.user.id,
      scopes:            oauth_scopes,
      expires_in:        oauth_expiry_time,
      use_refresh_token: oauth_server.refresh_token_enabled?
    )