I’m unable to access claims in my iOS app. I’m able to see a list of enum cases (no claim values) by running this code:
if let token = Credential.default?.token.idToken {
for claim in token.claims {
print(claim)
}
}
If I run this code taken from here, I get an error on the third line: “Generic parameter ‘T’ could not be inferred”:
if let token = Credential.default?.token.idToken {
for claim in token.claims {
let value = token[claim]
}
}
When I try the other examples on that page:
if let email = token[.email] {
// Do something with the token's email address
}
if let customValue = token["customClaim"] {
// Use the custom value
}
I get the error “Generic parameter ‘T’ could not be inferred” for each one. How do I access the values in my claims using Swift for iOS?