-
Notifications
You must be signed in to change notification settings - Fork 1
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
Chore(auth): store refresh token in cookie #240
Conversation
Coverage Report
File Coverage
|
}) | ||
.send({ | ||
accessToken, | ||
refreshToken, |
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.
you don't need to send rt via json then
src/domain/service/auth.ts
Outdated
@@ -71,7 +71,7 @@ export default class AuthService { | |||
* @param userId - user to sign refresh token for | |||
* @returns {Promise<string>} refresh token |
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.
update doc as well
src/presentation/http/router/auth.ts
Outdated
@@ -23,6 +23,11 @@ interface AuthRouterOptions { | |||
* Auth service instance | |||
*/ | |||
authService: AuthService, | |||
|
|||
/** | |||
* Cookie domain for refresh and access tokens |
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.
* Cookie domain for refresh and access tokens | |
* Cookie domain for refresh token |
refreshToken, | ||
}); | ||
return reply | ||
.setCookie('refreshToken', refreshToken, { |
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.
maybe call it "rt" ?
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.
I think this naming is not clear enough
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.
camel case is not a common practice for cookie names, as I know
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.
Maybe use snake case instead? refresh_token
for example
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.
yep
fcef5b5
to
49c2a8b
Compare
Now, we store refresh token as http only cookie