Class: Oauth::Provider

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/oauth/provider.rb

Instance Method Summary collapse

Instance Method Details

#authorize_url(params = {}) ⇒ Object



7
8
9
# File 'app/models/oauth/provider.rb', line 7

def authorize_url(params={})
  client.auth_code.authorize_url params.merge(redirect_uri: oauth2_callback_url)
end

#redeem_access_token(code, params = {}) ⇒ Object



11
12
13
# File 'app/models/oauth/provider.rb', line 11

def redeem_access_token(code, params={})
  client.auth_code.get_token(code, params.merge(redirect_uri: oauth2_callback_url))
end

#refresh_access_token(authorization) ⇒ Object



15
16
17
# File 'app/models/oauth/provider.rb', line 15

def refresh_access_token(authorization)
  OAuth2::AccessToken.from_hash(client, authorization.attributes).refresh!
end