Module: OauthDoorman::OauthSender

Included in:
Api
Defined in:
lib/oauth_doorman/oauth_sender.rb

Instance Method Summary collapse

Instance Method Details

#compose_authentification_request_url(force_refresh_token) ⇒ Object

force_refresh_token flag for refresh_token enforcement



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/oauth_doorman/oauth_sender.rb', line 6

def compose_authentification_request_url(force_refresh_token)
  hash_params = {}
  hash_params["client_id"] = config[:client_id]
  hash_params["response_type"] = config[:response_type]
  hash_params["redirect_uri"] = config[:redirect_uri]
  hash_params["state"] = config[:state]
  hash_params["scope"] = config[:scopes].join(" ")
  if(force_refresh_token)
    hash_params["access_type"] = "offline"
    hash_params["approval_prompt"] = "force"
  else
    hash_params["approval_prompt"] = "auto"
  end

  return "#{config[:auth_url]}?#{hash_params.to_query}"
end