lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-1.4.2 vs lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-2.0.0.alpha1
- old
+ new
@@ -8,15 +8,15 @@
@pre_auth = pre_auth
@resource_owner = resource_owner
end
def issue_token
- @token ||= AccessToken.create!(
- application_id: pre_auth.client.id,
- resource_owner_id: resource_owner.id,
- scopes: pre_auth.scopes.to_s,
- expires_in: configuration.access_token_expires_in,
- use_refresh_token: false
+ @token ||= AccessToken.find_or_create_for(
+ pre_auth.client,
+ resource_owner.id,
+ pre_auth.scopes,
+ configuration.access_token_expires_in,
+ false
)
end
def native_redirect
{