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

String value on expires_at results in exception #780

Closed
JTStoll opened this issue Oct 20, 2021 · 3 comments
Closed

String value on expires_at results in exception #780

JTStoll opened this issue Oct 20, 2021 · 3 comments
Labels
Bug OAuth2-Client This impact the client part of OAuth2.
Milestone

Comments

@JTStoll
Copy link

JTStoll commented Oct 20, 2021

Describe the bug

When a token passes a String date field for expires_at, an exception is thrown, making it impossible to parse the token.

My team encountered this attempting to do an OAuth flow with Square (https://squareup.com), so this is certainly happening in out in the wild. Square passes a string date, something like '2021-JUN-12 13:42:36'.

In addition, it looks as though this same issue would happen if a string were passed on exipires_in, though that seems much less likely. Still, a check on the data type wouldn't hurt.

How to reproduce

Attempt to parse a token with a String expires_at. An exception will be thrown.

Expected behavior

One of two things should happen. Either we should just ignore the expires_at field, or we should try to parse it as a datetime.

Personally, I'd go with the option of just ignoring any non-Integers in this field.

Additional context

The line this is happening on is here:

if 'expires_at' in response:

Either catch the exception or just checking that the expires_at field is valid before casting it as an int.

@auvipy
Copy link
Contributor

auvipy commented Oct 21, 2021

can you atleast provide or start with a failing test case?

@JTStoll
Copy link
Author

JTStoll commented Oct 21, 2021

I can do one better. We've come up with a PR to fix this:

#783

@JonathanHuot JonathanHuot added this to the 3.2.0 milestone Nov 2, 2021
@JonathanHuot
Copy link
Member

Fixed in #783

@JonathanHuot JonathanHuot added Bug OAuth2-Client This impact the client part of OAuth2. labels Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug OAuth2-Client This impact the client part of OAuth2.
Projects
None yet
Development

No branches or pull requests

3 participants