When you get an access token via headless registration or headless login, you can retrieve user information with a request to the User Info endpoint. Use this example to understand how.
In this example, the access token is passed in an Authorization Bearer header.
function getUserInfo(accessToken) {
client = new XMLHttpRequest();
client.open("GET", expDomain + userInfoURI, true);
client.setRequestHeader("Content-Type", "application/json");
client.setRequestHeader("Authorization", 'Bearer ' + accessToken);
client.send();
client.onreadystatechange = function() {
if(this.readyState == 4) {
if (this.status == 200) {
//User Info response
console.log(client.response);
} else {
console.log(client.response)
onError("An Error Occured during Forgot Password Step: " + forgotPasswordProcessStep, client.response);
}
}
}
}