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

JWT token claims values not only strings #1068

Closed
wants to merge 1 commit into from

Conversation

MichK1
Copy link

@MichK1 MichK1 commented Oct 23, 2018

When trying to get JWT values which are not Strings application written in Swift crashes.

@lucianboboc
Copy link
Contributor

I had the same crash today for accessing the claims from swift and if-let binding to [String:Any] is not working. Please accept this fix asap 🙏

@palpatim palpatim self-assigned this Nov 12, 2018
@palpatim
Copy link
Member

The change makes sense on the face of it, but I'm going to dive a bit deeper to make sure there's no implications I'm missing. Assuming the existing tests pass, I'd also like to add some Swift unit tests as well to ensure the correct deserialization behavior. I'm working on one locally--if I'm able to validate this change locally we can merge it into master and follow up on the next official release with expanded test coverage.

@palpatim
Copy link
Member

Hi @MichK1 and @lucianboboc,

Thanks for bringing this to our attention. Unfortunately, the proposed fix is a breaking change--callers who are currently relying on the property to be a [String : String] would have to add an explicit cast. Instead, I added your fix onto a new property, tokenClaims and deprecated claims. At some point after that, we can re-institute claims with the correct signature and retire the unfortunately-named tokenClaims. :)

We'll have that pushed in an upcoming release.

@palpatim palpatim added the work in progress Issues was triaged and investigation done label Nov 12, 2018
@palpatim
Copy link
Member

This is fixed by using the tokenClaims property introduced in 2.7.1.

@palpatim palpatim closed this Nov 13, 2018
@palpatim palpatim removed the work in progress Issues was triaged and investigation done label Nov 13, 2018
@MichK1
Copy link
Author

MichK1 commented Nov 16, 2018

Thanks guys for addressing this. 👍 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cognito Issues related to AWS Cognito
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants