mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-14 21:43:01 +00:00
Hit /user instead of /authorizations/token/<token>
This commit is contained in:
@@ -41,8 +41,11 @@ async def get_current_user(
|
|||||||
)
|
)
|
||||||
|
|
||||||
async with get_client() as client:
|
async with get_client() as client:
|
||||||
endpoint = "/authorizations/token/%s" % token
|
endpoint = "/user"
|
||||||
resp = await client.get(endpoint)
|
# normally we auth to Hub API with service api token,
|
||||||
|
# but this time auth as the user token to get user model
|
||||||
|
headers = {"Authorization": f"Bearer {token}"}
|
||||||
|
resp = await client.get(endpoint, headers=headers)
|
||||||
if resp.is_error:
|
if resp.is_error:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status.HTTP_400_BAD_REQUEST,
|
status.HTTP_400_BAD_REQUEST,
|
||||||
|
Reference in New Issue
Block a user