Module: OAuth2::Provider::Models::AuthorizationCode::ClassMethods

Defined in:
lib/oauth2/provider/models/authorization_code.rb

Instance Method Summary collapse

Instance Method Details

#claim(code, redirect_uri) ⇒ Object


18
19
20
21
22
23
24
25
# File 'lib/oauth2/provider/models/authorization_code.rb', line 18

def claim(code, redirect_uri)
  if authorization_code = find_by_code_and_redirect_uri(code, redirect_uri)
    if authorization_code.fresh?
      authorization_code.destroy
      authorization_code.authorization.access_tokens.create!
    end
  end
end