module Camper::Authorization
Public Instance Methods
authz_client()
click to toggle source
# File lib/camper/authorization.rb, line 12 def authz_client Rack::OAuth2::Client.new( identifier: @config.client_id, secret: @config.client_secret, redirect_uri: @config.redirect_uri, authorization_endpoint: @config.authz_endpoint, token_endpoint: @config.token_endpoint, ) end
update_access_token!()
click to toggle source
# File lib/camper/authorization.rb, line 39 def update_access_token! logger.debug "Update access token using refresh token" client = authz_client client.refresh_token = @config.refresh_token token = client.access_token!( client_auth_method: nil, client_id: @config.client_id, client_secret: @config.client_secret, type: :refresh ) store_tokens(token) token end
Private Instance Methods
store_tokens(token)
click to toggle source
# File lib/camper/authorization.rb, line 59 def store_tokens(token) @config.access_token = token.access_token @config.refresh_token = token.refresh_token end