I was using the Spring 5 - auth0 example
and want email claim, but I don’t get it why? Calling endpoint from postman, and specifying scope = openid profile email.
@GetMapping(value = "/private")
public Message privateEndpoint(@AuthenticationPrincipal Jwt jwt) {
Map<String, Object> claims = jwt.getClaims();
for (Object key: claims.keySet()) {
System.out.println("key: and value: "+ key.toString());// + "..."+ claims.get(key).asString());
}
key: and value: sub
key: and value: aud
key: and value: azp
key: and value: scope
key: and value: iss
key: and value: exp
key: and value: iat
You don’t say whether you are looking at the access token or the ID token. I think it is the access token you are looking at. You should try the ID token instead. Or you can add the email to the access token with a rule.