Skip to content

Commit 7bc92d3

Browse files
committed
Use a more precise way to encode SAML assertion
1 parent 48faeb7 commit 7bc92d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

msal/application.py

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

1010
from .oauth2cli import Client, JwtSigner
@@ -405,7 +405,7 @@ def _acquire_token_by_username_password_federated(
405405
raise RuntimeError(
406406
"RSTR returned unknown token type: %s", wstrust_result.get("type"))
407407
return self.client.obtain_token_by_assertion(
408-
b64encode(wstrust_result["token"]),
408+
urlsafe_b64encode(wstrust_result["token"]).strip(b'='),
409409
grant_type=grant_type, scope=scopes, **kwargs)
410410

411411

0 commit comments

Comments
 (0)