Skip to content

Commit 8654230

Browse files
committed
Rename acquire_token_with_authorization_code(..., scope, ...) to ...by...(..., scopes, ...)
1 parent a76755a commit 8654230

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

msal/application.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ def get_authorization_request_url(
146146
scope=decorate_scope(scopes, self.client_id),
147147
)
148148

149-
def acquire_token_with_authorization_code(
149+
def acquire_token_by_authorization_code(
150150
self,
151151
code,
152-
scope, # Syntactically required. STS accepts empty value though.
152+
scopes, # Syntactically required. STS accepts empty value though.
153153
redirect_uri=None,
154154
# REQUIRED, if the "redirect_uri" parameter was included in the
155155
# authorization request as described in Section 4.1.1, and their
@@ -158,7 +158,7 @@ def acquire_token_with_authorization_code(
158158
"""The second half of the Authorization Code Grant.
159159
160160
:param code: The authorization code returned from Authorization Server.
161-
:param scope:
161+
:param scopes:
162162
163163
If you requested user consent for multiple resources, here you will
164164
typically want to provide a subset of what you required in AuthCode.
@@ -178,10 +178,10 @@ def acquire_token_with_authorization_code(
178178
# So in theory, you can omit scope here when you were working with only
179179
# one scope. But, MSAL decorates your scope anyway, so they are never
180180
# really empty.
181-
assert isinstance(scope, list), "Invalid parameter type"
182-
return self.client.obtain_token_with_authorization_code(
181+
assert isinstance(scopes, list), "Invalid parameter type"
182+
return self.client.obtain_token_by_authorization_code(
183183
code, redirect_uri=redirect_uri,
184-
data={"scope": decorate_scope(scope, self.client_id)},
184+
data={"scope": decorate_scope(scopes, self.client_id)},
185185
)
186186

187187
def get_accounts(self):

tests/test_application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_auth_code(self):
124124
ac = obtain_auth_code(port, auth_uri=auth_request_uri)
125125
self.assertNotEqual(ac, None)
126126

127-
result = self.app.acquire_token_with_authorization_code(
127+
result = self.app.acquire_token_by_authorization_code(
128128
ac, CONFIG["scope"], redirect_uri=redirect_uri)
129129
logging.debug("cache = %s", json.dumps(self.app.token_cache._cache, indent=4))
130130
self.assertIn(

0 commit comments

Comments
 (0)