Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk/client/auth - KeyError: 'id_token' from _auth.py in id_token_from_refresh_token #4312

Closed
Bobgy opened this issue Aug 3, 2020 · 4 comments · Fixed by #5782
Closed

sdk/client/auth - KeyError: 'id_token' from _auth.py in id_token_from_refresh_token #4312

Bobgy opened this issue Aug 3, 2020 · 4 comments · Fixed by #5782
Labels

Comments

@Bobgy
Copy link
Contributor

Bobgy commented Aug 3, 2020

If getting “KeyError: 'id_token'” from “File "/Users/gongyuan/miniconda3/envs/mlpipeline/lib/python3.7/site-packages/kfp/_auth.py", line 192, in id_token_from_refresh_token
return (str(json.loads(res.text)[u"id_token"]))

The request to get id token from refresh token failed, but the client didn’t surface the underlying error message. The http response I got was

{
  "error": "invalid_grant",
  "error_description": "Bad Request"
}

And root cause: ~/.config/kfp/credentials.json has expired. I deleted it and got a new token: rm ~/.config/kfp/credentials.json.

Solution

res = requests.post(OAUTH_TOKEN_URI, data=payload)
return (str(json.loads(res.text)[u"refresh_token"]))
and
res = requests.post(OAUTH_TOKEN_URI, data=payload)
return (str(json.loads(res.text)[u"id_token"]))
, we should first check request response status code by Response.raise_for_exception, it could be 401 unauthorized.

@Bobgy Bobgy added area/sdk/client status/triaged Whether the issue has been explicitly triaged labels Aug 3, 2020
@stale
Copy link

stale bot commented Nov 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the lifecycle/stale The issue / pull request is stale, any activities remove this label. label Nov 1, 2020
@stale stale bot removed the lifecycle/stale The issue / pull request is stale, any activities remove this label. label Nov 1, 2020
@Bobgy
Copy link
Contributor Author

Bobgy commented Nov 1, 2020

/lifecycle frozen

@Bobgy
Copy link
Contributor Author

Bobgy commented Nov 15, 2020

/cc @chensun

@annajung
Copy link
Member

annajung commented Jun 1, 2021

Picking this up. Let me know if there is any problem in working on this issue. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants