Skip to content

Commit 1552449

Browse files
committed
Use the underlying encoder rather than ad-hoc one
1 parent 726cb41 commit 1552449

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

msal/application.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
except: # Python 3
55
from urllib.parse import urljoin
66
import logging
7-
from base64 import urlsafe_b64encode
87
import sys
98

109
from .oauth2cli import Client, JwtSigner
@@ -404,9 +403,10 @@ def _acquire_token_by_username_password_federated(
404403
if not grant_type:
405404
raise RuntimeError(
406405
"RSTR returned unknown token type: %s", wstrust_result.get("type"))
406+
self.client.grant_assertion_encoders.setdefault( # Register a non-standard type
407+
grant_type, self.client.encode_saml_assertion)
407408
return self.client.obtain_token_by_assertion(
408-
urlsafe_b64encode(wstrust_result["token"]).strip(b'='),
409-
grant_type=grant_type, scope=scopes, **kwargs)
409+
wstrust_result["token"], grant_type, scope=scopes, **kwargs)
410410

411411

412412
class ConfidentialClientApplication(ClientApplication): # server-side web app

0 commit comments

Comments
 (0)