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

Cant Unmarshal Exchange refresh token to type tokenJSON struct in v0.10.0 #655

Closed
fusesuphasin opened this issue Jul 21, 2023 · 0 comments
Closed

Comments

@fusesuphasin
Copy link

fusesuphasin commented Jul 21, 2023

This is true ?
When i request to Exchange token with auth code

in /token/internal.go line 240
body, err := ioutil.ReadAll(io.LimitReader(r.Body, 1<<20))
r.Body.Close()
if err != nil {
return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err)
}

the output is
{
"access_token": ",
"expires_in": 3594,
"scope": ",
"token_type": "Bearer",
"id_token": ""
}

but the type tokenJSON struct in line 281 is
type tokenJSON struct {
AccessToken string json:"access_token"
TokenType string json:"token_type"
RefreshToken string json:"refresh_token"
ExpiresIn expirationTime json:"expires_in" // at least PayPal returns string, while most return number
// error fields
// https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
ErrorCode string json:"error"
ErrorDescription string json:"error_description"
ErrorURI string json:"error_uri"
}

this is the reason why cant unmarshal to struct and not see the refresh token when Exchange.


If I'm wrong, please give me the right reasons. Thank you.

@fusesuphasin fusesuphasin changed the title Cant Unmarshal to type tokenJSON struct in v0.10.0 Cant Unmarshal Exchange refresh token to type tokenJSON struct in v0.10.0 Jul 21, 2023
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

1 participant