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

Deserialization of TokenInfo fails when serde_json's arbitrary_precision feature is enabled #161

Closed
JamesHinshelwood opened this issue Sep 15, 2021 · 0 comments · Fixed by #162

Comments

@JamesHinshelwood
Copy link

I am enabling serde_json's arbitrary_precision feature in an upstream crate, which strangely causes the serde_json::from_slice::<serde_json::Value>(json_data) call in TokenInfo::from_json to return an Err.

I believe this is due to an issue in serde_json:
serde-rs/json#559

Apologies for raising the issue in this repository, but I would like to ask if you would consider accepting a workaround which means this crate can still be used when the arbitrary_precision feature is turned on? Specifically, I'd like to change the deserialization to

// Serialize first to a `serde_json::Value` then to `AuthErrorOr<RawToken>` to work around this bug in
// serde_json: https://github.com/serde-rs/json/issues/559
let raw_token = serde_json::from_slice::<serde_json::Value>(json_data)?;
let RawToken {
    access_token,
    refresh_token,
    token_type,
    expires_in,
} = <AuthErrorOr<RawToken>>::deserialize(raw_token)?.into_result()?;
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 a pull request may close this issue.

1 participant