class OAuth2::Strategy::Implicit

The Implicit Strategy

@see datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-26#section-4.2

Public Instance Methods

authorize_params(params = {}) click to toggle source

The required query parameters for the authorize URL

@param [Hash] params additional query parameters

# File lib/oauth2/strategy/implicit.rb, line 12
def authorize_params(params = {})
  params.merge('response_type' => 'token', 'client_id' => @client.id)
end
authorize_url(params = {}) click to toggle source

The authorization URL endpoint of the provider

@param [Hash] params additional query parameters for the URL

# File lib/oauth2/strategy/implicit.rb, line 19
def authorize_url(params = {})
  assert_valid_params(params)
  @client.authorize_url(authorize_params.merge(params))
end
get_token(*) click to toggle source

Not used for this strategy

@raise [NotImplementedError]

# File lib/oauth2/strategy/implicit.rb, line 27
def get_token(*)
  raise(NotImplementedError, 'The token is accessed differently in this strategy')
end

Private Instance Methods

assert_valid_params(params) click to toggle source
# File lib/oauth2/strategy/implicit.rb, line 33
def assert_valid_params(params)
  raise(ArgumentError, 'client_secret is not allowed in authorize URL query params') if params.key?(:client_secret) || params.key?('client_secret')
end