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

Requesting new refresh tokens #5

Closed
AmSmart opened this issue Oct 28, 2021 · 2 comments
Closed

Requesting new refresh tokens #5

AmSmart opened this issue Oct 28, 2021 · 2 comments

Comments

@AmSmart
Copy link

AmSmart commented Oct 28, 2021

I am opening this as an issue because discussions are not enabled on this repo. I love and use this template that you have provided because of its simplicity and effectiveness. I'd love to ask a question though. Is there any reason why a user needs to have a valid access token in order to call the /refresh-token endpoint?

@changhuixu
Copy link
Contributor

I would say, most of online tutorials don't have this. So it might be ok to not need a valid access token to refresh token.

However, if we look at the refresh tokens generation (below), we need to understand the risks that enumerating all refresh tokens is not difficult and we can brute force to get tokens for some users.

private static string GenerateRefreshTokenString()
{
var randomNumber = new byte[32];
using var randomNumberGenerator = RandomNumberGenerator.Create();
randomNumberGenerator.GetBytes(randomNumber);
return Convert.ToBase64String(randomNumber);
}

@AmSmart
Copy link
Author

AmSmart commented Oct 28, 2021

I didn't even consider this. This is a good enough reason. Thanks for the response!

@AmSmart AmSmart closed this as completed Oct 28, 2021
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

No branches or pull requests

2 participants