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

Client does not refresh token #662

Open
maxsupermanhd opened this issue Aug 29, 2023 · 3 comments
Open

Client does not refresh token #662

maxsupermanhd opened this issue Aug 29, 2023 · 3 comments

Comments

@maxsupermanhd
Copy link

Trying to add a discord oauth2 (using github.com/ravener/discord-oauth2) but whenever token expires it fails(?) to refresh it and returns Get "https://discord.com/api/users/@me": oauth2: cannot fetch token: 400 Bad Request-Response: {"error": "invalid_grant"}

I manually check for modification of AccessToken, RefreshToken and Expiry and store it in the database. Whenever it is time for token to be refreshed it just fails with error above.

Code: https://github.com/Warzone2100/wz2100-autohost.net/blob/master/discordauth.go#L51
Token struct storage: https://github.com/Warzone2100/wz2100-autohost.net/blob/master/main.go#L134C8-L134C8

@andig
Copy link
Contributor

andig commented Oct 2, 2023

How is this related to the oauth2 package? Seems you'll need to open issue upstream.

@maxsupermanhd
Copy link
Author

maxsupermanhd commented Oct 3, 2023

Seems you'll need to open issue upstream.

I already talked to ravener about the issue and he does not know the cause of it. Problem is that Other social networks like VK does not refresh their token either. It seems to me that oauth2 library does not refresh token for me even though it is clearly said in the docs that it should and will do it when needed.

@andig
Copy link
Contributor

andig commented Oct 3, 2023

Sounds like an application, not a library issue. I'd suggest to debug the application code. This is not an oauth2 package topic.

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