Skip to content

Conversation

@cluther
Copy link
Contributor

@cluther cluther commented Jan 11, 2025

Attempting to get a refresh_token from login.microsoft.com would result
in the following error message.

failed to parse exchange response: json: cannot unmarshal string into Go struct field TokenResponse.expires_in of type int64

This happens because their API is returning expires_in as a JSON
string instead of as a JSON number as expected. It seems this is in
violation of the OAuth2 spec, but it's happening nonetheless.

This change allows expires_in to be accepted as an int64 whether it's
encoded as a JSON number or string.

Attempting to get a refresh_token from login.microsoft.com would result
in the following error message.

    failed to parse exchange response: json: cannot unmarshal string into Go struct field TokenResponse.expires_in of type int64

This happens because their API is returning `expires_in` as a JSON
string instead of as a JSON number as expected. It seems this is in
violation of the OAuth2 spec, but it's happening nonetheless.

This change allows `expires_in` to be accepted as an int64 whether it's
encoded as a JSON number or string.
@mbilski mbilski merged commit 653ff88 into SecureAuthCorp:master Jan 13, 2025
@cluther cluther deleted the expires-in-string branch January 13, 2025 12:15
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.

2 participants