Skip to content

Allow casting from String -> Double when checking timestamps #12

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

Merged
merged 2 commits into from
Oct 1, 2015

Conversation

parrots
Copy link
Contributor

@parrots parrots commented Sep 26, 2015

Not all server-side JWT packages drop the quotes around returned values. If a timestamp is returned with quotes a decoding error will occur because as? NSTimeInterval will fail on strings. This will also attempt to parse strings to a double value and use that as the timestamp.

(Ideally this would be a change for the JSON parser, but that isn't something we can control)

Not all server-side JWT packages drop the quotes around returned values, which causes a decoding error to occur because `as? NSTimeInterval` will fail on strings.
@kylef
Copy link
Owner

kylef commented Sep 26, 2015

Thanks @parrots.

Can you add a small test to ensure that this works as intended?

You just be able to copy https://github.com/kylef/JSONWebToken.swift/blob/master/JWTTests/JWTTests.swift#L127-L133 and modify it slightly.

kylef added a commit that referenced this pull request Oct 1, 2015
Allow casting from String -> Double when checking timestamps
@kylef kylef merged commit aef1055 into kylef:master Oct 1, 2015
@kylef
Copy link
Owner

kylef commented Oct 1, 2015

Thanks @parrots!

@parrots
Copy link
Contributor Author

parrots commented Oct 1, 2015

No problem, thanks for the library!

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