Skip to content

Commit

Permalink
adjust for encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkahan committed Jun 7, 2024
1 parent 5f96501 commit d208c33
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/vonage/camara_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_oidc_url(
redirect_uri: str,
state: str = None,
login_hint: str = None,
scope: str = 'openid+dpv:FraudPreventionAndDetection#number-verification-verify-read',
scope: str = 'openid dpv:FraudPreventionAndDetection#number-verification-verify-read',
):
"""Get the URL to use for authentication in a front-end application.
Expand All @@ -59,7 +59,10 @@ def get_oidc_url(
if state:
params['state'] = state
if login_hint:
params['login_hint'] = login_hint
if login_hint.startswith('+'):
params['login_hint'] = login_hint
else:
params['login_hint'] = f'+{login_hint}'

full_url = urlunparse(('', '', base_url, '', urlencode(params), ''))
return full_url
Expand Down
2 changes: 1 addition & 1 deletion src/vonage/number_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_oidc_url(
redirect_uri: str,
state: str = None,
login_hint: str = None,
scope: str = 'openid+dpv:FraudPreventionAndDetection#number-verification-verify-read',
scope: str = 'openid dpv:FraudPreventionAndDetection#number-verification-verify-read',
):
"""Get the URL to use for authentication in a front-end application.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_camara_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ def test_get_oidc_url(camara_auth: CamaraAuth):

assert (
url
== 'https://oidc.idp.vonage.com/oauth2/auth?client_id=nexmo-application-id&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback&response_type=code&scope=openid%2Bdpv%3AFraudPreventionAndDetection%23number-verification-verify-read&state=state_id&login_hint=447700900000'
== 'https://oidc.idp.vonage.com/oauth2/auth?client_id=nexmo-application-id&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback&response_type=code&scope=openid+dpv%3AFraudPreventionAndDetection%23number-verification-verify-read&state=state_id&login_hint=%2B447700900000'
)
2 changes: 1 addition & 1 deletion tests/test_number_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_get_oidc_url(number_verification: NumberVerification):

assert (
url
== 'https://oidc.idp.vonage.com/oauth2/auth?client_id=nexmo-application-id&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback&response_type=code&scope=openid%2Bdpv%3AFraudPreventionAndDetection%23number-verification-verify-read&state=state_id&login_hint=447700900000'
== 'https://oidc.idp.vonage.com/oauth2/auth?client_id=nexmo-application-id&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback&response_type=code&scope=openid+dpv%3AFraudPreventionAndDetection%23number-verification-verify-read&state=state_id&login_hint=%2B447700900000'
)


Expand Down

0 comments on commit d208c33

Please sign in to comment.