Class: Vonage::NetworkAuthentication::ClientAuthentication

Inherits:
Vonage::Namespace
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/vonage/network_authentication/client_authentication.rb

Instance Method Summary collapse

Instance Method Details

#generate_oidc_uri(purpose:, api_scope:, login_hint:, redirect_uri:, state:) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/vonage/network_authentication/client_authentication.rb', line 26

def generate_oidc_uri(purpose:, api_scope:, login_hint:, redirect_uri:, state:)
  scope = "openid%20dpv:#{purpose}%23#{api_scope}"
  uri = "https://oidc.idp.vonage.com/oauth2/auth?" +
    "client_id=#{@config.application_id}" +
    "&response_type=code" +
    "&scope=#{scope}" +
    "&login_hint=#{}" +
    "&redirect_uri=#{redirect_uri}" +
    "&state=#{state}"

  uri
end

#token(oidc_auth_code:, redirect_uri:, **params) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vonage/network_authentication/client_authentication.rb', line 14

def token(oidc_auth_code:, redirect_uri:, **params)
  request(
    '/oauth2/token',
    params: {
      grant_type: 'authorization_code',
      code: oidc_auth_code,
      redirect_uri: redirect_uri
    },
    type: Post
  ).access_token
end