Skip to content

Conversation

@adamluckdev
Copy link

Hi @markitosgv

I created support for refresh token in cookie. Cookie is also automatically extracted. Cookie is by default httpOnly, thus cannot be read by JS and it's safe against XSS attack.

@JustDylan23
Copy link

The whole point of a refresh token is to have a way to get the token after refreshing the page so you dont have to save the token in the localStorage or as a cookie which are both vulnerable to attacks from hackers. if you dont store the refresh token in a HttpOnly cookie its still vulnerable from attacks from hackers which would defeat the entire point of a refresh token and make the bundle useless. I say that it should be stored in a cookie by default and that there should be no other options for security reasons.

@koekaverna
Copy link

Wow great work @lukacovicadam 👍
As I see there is some code style issues. I look forward to it merged.

@nicodmf
Copy link

nicodmf commented Sep 4, 2020

Very important feature, I can't wait to use it

@nicodmf
Copy link

nicodmf commented Sep 11, 2020

@markitosgv i have tested it and use the fork actually on my projects, all is functional.
Could you please review this great work ?

@markitosgv
Copy link
Owner

@lukacovicadam could you please fix style issues in order to merge it to master and make a release? thanks

@adamluckdev
Copy link
Author

@markitosgv Sure, but in StyleCI diff I see marked lines, which I didn't edit or add. Should I fix it anyway? Or could you fix it like in #194 ?

@nicodmf
Copy link

nicodmf commented Sep 25, 2020

@markitosgv the Lukacovicadam's proposition seems fair to me, are you agree ?

@vroad
Copy link

vroad commented Oct 7, 2020

Shouldn't we encrypt or sign refresh token, so that hackers can't try random values without app secret?

@mindaugasw
Copy link

Are there any plans to merge this sometime?

If I understand correctly, using HttpOnly cookie is in theory the safest way possible? So this would be a very welcome feature.

@jacquesndl
Copy link

I agree. Is something blocking the merge?
Thanks

@NachoBrito
Copy link

@markitosgv @lukacovicadam Sorry guys, I don't understand how this important feature is complete but not merged due to code style issues nobody seems willing to fix ¯_(ツ)_/¯

$refreshTokenString = isset($params[$tokenParameterName]) ? trim($params[$tokenParameterName]) : null;
} elseif (null !== $request->get($tokenParameterName)) {
$refreshTokenString = $request->get($tokenParameterName);
} elseif (null !== $request->cookies) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} elseif (null !== $request->cookies) {
} elseif ($request->cookies->has($tokenParameterName)) {

@morawskim
Copy link
Contributor

Hello @markitosgv @lukacovicadam

I have created a pull request to fix the current master version (#224).
I also rebase this PR on top of the new master and send this PR to @lukacovicadam - https://github.com/lukacovicadam/JWTRefreshTokenBundle/pull/1
I can't edit this commit, because I don't have privileges.

If you want I could create a new PR from this branch - https://github.com/morawskim/JWTRefreshTokenBundle/tree/cookie
I also fix - #199 (comment)

If there are some other issues let me know.
This feature will be very useful for me in one project and I would like to use the official version than a fork.

@adamluckdev
Copy link
Author

Hello,
PR is rebased to current master and code style is also fixed.

@adamluckdev
Copy link
Author

Hi @markitosgv , is there possibility to merge my PR, please?

@db306
Copy link

db306 commented Jul 4, 2021

Good stuff ! It will definitely remove my hacky code :)

} elseif (null !== $request->get($tokenParameterName)) {
$refreshTokenString = $request->get($tokenParameterName);
} elseif (null !== $request->cookies) {
$refreshTokenString = $request->cookies->get($tokenParameterName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part needs to be rework with the new extractor implementation

@Jayfrown
Copy link
Contributor

FYI, I have opened a new PR which is basically the result of cherry-picking these changes on top of the current master, resolving the conflicts that emerge, and adapting it to the new extractor implementation. It works locally and passes CI tests.

#274

@adamluckdev
Copy link
Author

Thank you @Jayfrown . I'm closing this PR in favor of yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.