Skip to content

Commit 56e9586

Browse files
committed
Merge branch 'formdata' into 'main'
Submit data as form encoded data in the payload instead of query parameters See merge request cit/mathworks/jupyter-matlab-proxy!10
2 parents 9cad3b7 + b6aedc5 commit 56e9586

File tree

1 file changed

+20
-3
lines changed
  • jupyter_matlab_proxy/util

1 file changed

+20
-3
lines changed

jupyter_matlab_proxy/util/mw.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@ async def fetch_entitlements(mhlm_api_endpoint, access_token, matlab_release):
1818
# Get entitlements for token
1919
async with aiohttp.ClientSession() as client_session:
2020
async with client_session.post(
21-
f"{mhlm_api_endpoint}?token={access_token}&release={matlab_release}&coreProduct=ML&context=jupyter&excludeExpired=true",
21+
mhlm_api_endpoint,
2222
headers={"content-type": "application/x-www-form-urlencoded"},
23+
data=aiohttp.FormData({
24+
"token": access_token,
25+
"release": matlab_release,
26+
"coreProduct": "ML",
27+
"context": "jupyter",
28+
"excludeExpired": "true",
29+
}),
2330
) as res:
2431

2532
if res.reason != "OK":
@@ -51,12 +58,17 @@ async def fetch_expand_token(mwa_api_endpoint, identity_token, source_id):
5158

5259
async with aiohttp.ClientSession() as client_session:
5360
async with client_session.post(
54-
f"{mwa_api_endpoint}/tokens?tokenString={identity_token}&tokenPolicyName=R1&sourceId={source_id}",
61+
f"{mwa_api_endpoint}/tokens",
5562
headers={
5663
"content-type": "application/x-www-form-urlencoded",
5764
"accept": "application/json",
5865
"X_MW_WS_callerId": "desktop-jupyter",
5966
},
67+
data=aiohttp.FormData({
68+
"tokenString": identity_token,
69+
"tokenPolicyName": "R1",
70+
"sourceId": source_id,
71+
}),
6072
) as res:
6173

6274
if res.reason != "OK":
@@ -80,12 +92,17 @@ async def fetch_access_token(mwa_api_endpoint, identity_token, source_id):
8092

8193
async with aiohttp.ClientSession() as client_session:
8294
async with client_session.post(
83-
f"{mwa_api_endpoint}/tokens/access?tokenString={identity_token}&type=MWAS&sourceId={source_id}",
95+
f"{mwa_api_endpoint}/tokens/access",
8496
headers={
8597
"content-type": "application/x-www-form-urlencoded",
8698
"accept": "application/json",
8799
"X_MW_WS_callerId": "desktop-jupyter",
88100
},
101+
data=aiohttp.FormData({
102+
"tokenString": identity_token,
103+
"type": "MWAS",
104+
"sourceId": source_id,
105+
}),
89106
) as res:
90107

91108
if res.reason != "OK":

0 commit comments

Comments
 (0)