yourkarma / JWT

A JSON Web Token implementation in Objective-C.
MIT License
351 stars 107 forks source link

JWT token decoding failing #190

Open jayrawat opened 6 years ago

jayrawat commented 6 years ago

My code to decode jet token received in JSON response

    NSString *jwtToken = @"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ7XCJpZFwiOjEsXCJyb2xlc0lkXCI6MSxcInVzZXJOYW1lXCI6";
    NSString *secret = @"8ecc3c633lhjkghjghg2129";
    NSString *algorithmName = @"HS512"; //Must specify an algorithm to use
    NSDictionary *payload = [JWTBuilder decodeMessage:jwtToken].secret(secret).algorithmName(algorithmName).decode;

payload dictionary always prints null. Do i need to do it in any other way?

lolgear commented 6 years ago

@jaggudada1992 I suppose that jwtToken is broken. It should have at least three dots. Also, try to use API 3. It is still in beta in case of some possible changes / bug fixes, but ok for production code.