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

Support expires_in as a number or string #119

Merged
merged 2 commits into from
Jan 13, 2025

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 cloudentity: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