golang / oauth2

Go OAuth2
https://golang.org/x/oauth2
BSD 3-Clause "New" or "Revised" License
5.39k stars 992 forks source link

Client does not refresh token #662

Open maxsupermanhd opened 1 year ago

maxsupermanhd commented 1 year ago

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 commented 1 year ago

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

maxsupermanhd commented 1 year ago

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 commented 1 year ago

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