Hi there.
i have been using
auth0-spring-security-api, version: 0.3.2
together with
auth0, version: 0.4.0
In my java backend i have been using the following lines of code to access the id_token and call method to access the user name
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String userName = auth0Client.getUsername((Auth0JWTToken) auth);
getUser name looks like this:
public String getUsername(Auth0JWTToken token) {
final Request<UserProfile> request = client.tokenInfo(token.getJwt());
final UserProfile profile = request.execute();
return profile.getEmail();
when i uppdate to
auth0-spring-security-api, version: 1.0.0-rc.2
together with
auth0, version: 1.1.0
the method i have been using is not valid can some one help me?
i have been trying to access the email with the following snippets
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String userName = auth0Client.getUsername(auth.getCredentials().toString());
and
public String getUsername(String token) {
Request<UserInfo> request = auth0.userInfo(token);
String email;
try {
UserInfo info = request.execute();
System.out.println(info.toString());
} catch (APIException exception) {
System.out.println(exception.toString());
} catch (Auth0Exception exception) {
System.out.println(exception.toString());
}
return email;
}
but it gives me a 400 or a 401 error. any suggestions on whats going wrong or how i can do it different?