class OmniAuth::Strategies::Canvas

Public Instance Methods

authorize_params() click to toggle source

Override authorize_params so that we can be deliberate about the value for state and not use the session which is unavailable inside of an iframe for some browsers (ie Safari)

# File lib/omniauth/strategies/canvas.rb, line 55
def authorize_params
  # Only set state if it hasn't already been set
  options.authorize_params[:state] ||= SecureRandom.hex(24)
  params = options.authorize_params.merge(options_for("authorize"))
  if OmniAuth.config.test_mode
    @env ||= {}
    @env["rack.session"] ||= {}
  end
  params
end
query_string() click to toggle source

Passing any query string value to Canvas will result in: redirect_uri does not match client settings so we set the value to empty string

# File lib/omniauth/strategies/canvas.rb, line 48
def query_string
  ""
end
raw_info() click to toggle source
# File lib/omniauth/strategies/canvas.rb, line 41
def raw_info
  @raw_info ||= access_token.get("/api/v1/users/#{access_token['user']['id']}/profile").parsed
end