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

Invalid id_token claims part. Failed to decode base64 #1

Closed
mkoorn opened this issue Oct 16, 2014 · 3 comments · Fixed by #2
Closed

Invalid id_token claims part. Failed to decode base64 #1

mkoorn opened this issue Oct 16, 2014 · 3 comments · Fixed by #2

Comments

@mkoorn
Copy link

mkoorn commented Oct 16, 2014

Some JTW payloads could not be decoded and failed with this error.

This occurred in payloads which included an url. (not all url's failed)
I was able to fix this with this lib:https://github.com/qmihara/QMBase64URLSafe

and replacing:
NSData *claimsData = [[NSData alloc] initWithBase64EncodedString:claimsBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters];

with:
NSData *claimsData = [[NSData alloc] qm_initWithBase64URLSafeEncodedString:claimsBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters];

@hzalaz
Copy link
Member

hzalaz commented Oct 16, 2014

Hi @mkoorn!.
Do you have a JWT that you can send me so I can see what's wrong and also create a test for that case?.
I can use that library as a dependency but I want to keep JWTDecode simple and without external dependencies.

Thanks!

@mkoorn
Copy link
Author

mkoorn commented Oct 16, 2014

Hi @hzalaz
for example this one:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1M2VjNjdkODI1NDIyMzE3MDAzNGYxNzciLCJlbWFpbCI6Im15ZW1haWxAZ21haWwuY29tIiwicHJvZmlsZV9waWN0dXJlIjoiaHR0cDovL2Nkbi51YnVidWJ0ZXN0ZXIuaW8vN2Q4MjU0MjIzMTcwMDM0ZjE3Ny5wbmc_dD0xNDEzNDQyMTI4OTAwIiwiaWF0IjoxNDEzNDcyNzUyfQ.WEELiFZqavfxPcnZ7vz44gbPMbEc0xeCaaS53btTYXY

@hzalaz
Copy link
Member

hzalaz commented Oct 17, 2014

@mkoorn just released a new version (0.2.1) in CococaPods with the fix.

Thanks!

This issue was closed.
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.

2 participants