So here’s my code
async function getProfile() {
const accessToken = “{REMOVED FOR SECURITY}”;
const response = await fetch(‘https://portal.hawxservices.com/api/v1/users/me’, {
headers: {
Authorization: Bearer ${accessToken}
,
Accept: ‘application/json’
}
});
const user = await response.json();
const firstName = user.profile.firstName;
const lastName = user.profile.lastName;
const email = user.profile.email;
const phone = user.profile.mobilePhone || 'N/A';
console.log({ firstName, lastName, email, phone });
}
getProfile();
the issue is when I run this I get an error 401(unathorized) from Okta, so I am running this off of local host and have it set to a trust url already. any idea on why this is happeing? Thanks!
I also have this code run when there is already an active user session.