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

Expiration date is not being parsed when the value comes as a string #23

Closed
mottihoresh opened this issue Apr 5, 2016 · 5 comments
Closed

Comments

@mottihoresh
Copy link

Token:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJzdWIiOiJ4eHh4QHh4eHh4LmNvbSIsImlzcyI6Imh0dHBzOi8veHh4eHh4bnVtYmVycyIsImlhdCI6IjE0NTk4NzAyNzQiLCJleHAiOiIxNDU5ODcyMDc0IiwibmJmIjoiMTQ1OTg3MDI3NCIsImp0aSI6IjQ2ODA5YTYwNzQzMmU5ZDcwMmYwMWQ0MWQ2Y2FmMjNmIn0.fiA0lVKpUMkt48MGZ4J857V6hgDymJjtlx36oUm2W5s

["nbf": 1459870274, "exp": 1459872074, "iss": https://xxxxxx/numbers, "jti": 46809a607432e9d702f01d41d6caf23f, "iat": 1459870274, "sub": [email protected]]
nil


Sample Token:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tIiwic3ViIjoiYXV0aDB8MTAxMDEwMTAxMCIsImF1ZCI6Imh0dHBzOi8vc2FtcGxlcy5hdXRoMC5jb20iLCJleHAiOjEzNzI2NzQzMzYsImlhdCI6MTM3MjYzODMzNiwianRpIjoicXdlcnR5MTIzNDU2IiwibmJmIjoxMzcyNjM4MzM2fQ.LvF9wSheCB5xarpydmurWgi9NOZkdES5AbNb_UWk9Ew

["aud": https://samples.auth0.com, "sub": auth0|1010101010, "nbf": 1372638336, "iat": 1372638336, "jti": qwerty123456, "exp": 1372674336, "iss": https://samples.auth0.com]
Optional(2013-07-01 10:25:36 +0000)

@hzalaz
Copy link
Member

hzalaz commented Apr 5, 2016

@mottihoresh I think the jwt RFC states that it should be a numeric value

@mottihoresh
Copy link
Author

@hzalaz yea that would make the most sense, I am using php for my backend, when using the json_encode it convert everything to a string.

I'm just getting into iOS development so by no means I really know what I do :) but this seems to solve the "problem"

guard let timestamp:Double = claim(name) else {
            if let timestamp:String = claim(name) {
                return NSDate(timeIntervalSince1970: Double(timestamp)!)
            }
            return nil
        }

@hzalaz
Copy link
Member

hzalaz commented Apr 5, 2016

I know but I am not too keen to do that since it should be a numeric value not a string

mottihoresh added a commit to mottihoresh/JWTDecode.swift that referenced this issue Apr 5, 2016
@mottihoresh
Copy link
Author

Gotcha are you aware of any workarounds?

@hzalaz
Copy link
Member

hzalaz commented Apr 5, 2016

Sorry, I am not too familiar with php

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

No branches or pull requests

2 participants