Method: DocuSign_Maestro::ApiClient#get_authorization_uri

Defined in:
lib/docusign_maestro/client/api_client.rb

#get_authorization_uri(client_id, scopes, redirect_uri, response_type, state = nil) ⇒ String

Helper method to configure the OAuth accessCode/implicit flow parameters

Parameters:

  • client_id (String)

    DocuSign OAuth Client Id(AKA Integrator Key)

  • scopes

    The list of requested scopes. Client applications may be scoped to a limited set of system access.

  • redirect_uri (String)

    This determines where to deliver the response containing the authorization code

  • response_type (String)

    Determines the response type of the authorization request, NOTE: these response types are mutually exclusive for a client application. A public/native client application may only request a response type of “token”. A private/trusted client application may only request a response type of “code”.

  • state (String) (defaults to: nil)

    Allows for arbitrary state that may be useful to your application. The value in this parameter will be round-tripped along with the response so you can make sure it didn’t change.

Returns:

  • (String)

437
438
439
440
441
442
443
444
445
446
# File 'lib/docusign_maestro/client/api_client.rb', line 437

def get_authorization_uri(client_id, scopes, redirect_uri, response_type, state=nil)
  self.oauth_base_path ||= self.get_oauth_base_path

  scopes = scopes.join(' ') if scopes.kind_of?(Array)
  scopes = OAuth::SCOPE_SIGNATURE if scopes.empty?

  uri = "https://%{base_path}/oauth/auth?response_type=%{response_type}&scope=%{scopes}&client_id=%{client_id}&redirect_uri=%{redirect_uri}"
  uri += "&state=%{state}" if state
  uri  % {base_path: self.oauth_base_path, response_type:response_type, scopes: scopes, client_id: client_id, redirect_uri: redirect_uri, state: state}
end