Auth0 Home Blog Docs

Trouble decoding credentials token for connection string claim



I’m using Swift 4.1 in an iOS app and can successfully authenticate to Auth0 via the Auth0.webAuth() method in your cocoapods pod. I get back various “claims”, one of which is an “identities” claim which will tell me the connection string. The problem is I see no way to access that key/value pair. I’m trying the following swift code:

let jwtToken = try decode(jwt: credentials.idToken!)
let identities_claim = jwtToken.claim(name: “identities”)
if let identities = identities_claim.array {
print(“Identities array=”,identities)

But the cast to .array is not working. How can I decode the jwtToken for the connection string?



Hey there @bart.jenkins001!

I think like the clue here will be about extracting data from nested JSON data. Could you let me know if you are able to successfully retrieve what you want with this line of code:

let identities_claim = jwtToken.claim(name: “identities”)

and if so, what’s the type of identities_claim ?

Looking forward to provide you with more help!


Hey there @bart.jenkins001!

Have you been able to retrieve the data by now? Let me know if you need any further assistance!