-
Notifications
You must be signed in to change notification settings - Fork 287
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
feat: Refresh access tokens on 401 errors #394
Conversation
602858c
to
b88c947
Compare
b88c947
to
3aafbcc
Compare
Added @mikemurray as primary reviewer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@impactmass See some comments on the diff
src/server.js
Outdated
} catch (error) { | ||
logger.error("Error creating encoded config string", error); | ||
} | ||
res.cookie("oauth_client_config", encoded); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a cookie needed here? Can you add these three config values to the public app config instead? publicRuntimeConfig
in next.config.js
3aafbcc
to
6f3aee1
Compare
6f3aee1
to
72403f6
Compare
changes made. Readme added for cookie issue
@@ -0,0 +1,28 @@ | |||
# Auth & Cookies | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aldeed @ticean @rosshadden these proposed changes to how we use cookies need a few more eyes to review. I've written this readme doc, per Eric's earlier review, to list the changes and will like comments from you all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me @impactmass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @impactmass. Thanks for the great writeup. Switching to an insecure cookie (not HTTP-only) is a blocker. Especially with a refresh token in it. Refreshes don't expire. All the conventional wisdom suggests that it shouldn't be stored in the browser [citation needed].
I understand the impact on user experience with short-lived access tokens. Can we take some intermediate, secure solutions to move toward the desired state? For example, a full redirect flow would be possible with the tradeoff that it's more intrusive on the user experience because it kicks out of the SPA. Would that be acceptable enough for now to move things forward until we get something like a tested, iframe solution going? Are there other intermediate (or permanent) solutions that would work? Have suggestions @aldeed?
Based on the discussions from this review (especially the case around using not HTTP-only cookie, I'm adding token "refresh flow with redirects only" in #399 (almost finishing up). |
Resolves #350
Type: feature
Issue
Get a new access token from Hydra.
Solution
Breaking changes
None
Testing