Skip to content

Commit 81721ee

Browse files
committed
organizationNameKey support for stormpath token grant type
1 parent 0858805 commit 81721ee

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

‎stormpath/api_auth.py‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class StormpathTokenGrantAuthenticator(Authenticator):
525525
"""This class should authenticate using ID Site JWT.
526526
It gets authentication tokens for valid credentials.
527527
"""
528-
def authenticate(self, id_site_jwt, account_store=None, url=None):
528+
def authenticate(self, id_site_jwt, organization_name_key=None, account_store=None, url=None):
529529
"""Method that authenticates with ID Site JWT.
530530
531531
:param account_store: If this parameter is set, token
@@ -546,6 +546,12 @@ def authenticate(self, id_site_jwt, account_store=None, url=None):
546546
'token': id_site_jwt
547547
}
548548

549+
if organization_name_key:
550+
if isinstance(organization_name_key, string_types):
551+
data['organizationNameKey'] = organization_name_key
552+
else:
553+
raise TypeError('Unsupported type for organization_name_key.')
554+
549555
if account_store:
550556
if isinstance(account_store, string_types):
551557
data['accountStore'] = account_store
@@ -599,9 +605,15 @@ def authenticate(self, provider_id, code=None, access_token=None, account_store=
599605
}
600606

601607
if code:
602-
data['code'] = code
608+
if isinstance(code, string_types):
609+
data['code'] = account_store
610+
else:
611+
raise TypeError("Unsupported type for 'code'.")
603612
elif access_token:
604-
data['accessToken'] = access_token
613+
if isinstance(access_token, string_types):
614+
data['accessToken'] = access_token
615+
else:
616+
raise TypeError('Unsupported type for code.')
605617
else:
606618
raise TypeError("'code' or 'access_token' params are required.")
607619

0 commit comments

Comments
 (0)