
Andrew EmanuelA.31616 (Customer) asked a question.
I’m currently trying to get my application to read user emails from connected Okta accounts, however I keep getting a 403 error in return.
I’m using a framework which gets the accessToken, refreshToken and idToken when the user is logged in and the call I’m making to the api is as follows where the bearer token is the access token and the idToken is it’s namesake. Am I to understand that the idToken in the context of the API pertains to something else?
An excerpt of the code I'm using is:
const headers = {
Accept: "application/json; okta-version=1.0.0",
Authorization: `Bearer ${bearerToken}`
}
axios({
method: 'get',
url: `https://${yourOktaDomain}/idp/myaccount/emails/${idToken}`,
headers: headers
}).then((response) => {
console.log(response.data);
}).catch((err) => {
console.error(err);
});

Hi @Andrew EmanuelA.31616 (Customer) , Thank you for reaching out to the Okta Community!
This seems similar to the following post:
https://devforum.okta.com/t/403-error-when-making-call-to-get-emails-react-native-axios/23179
I'm posting this here as well so others that may need help get directed to our Developer colleagues.
--------------------------------
Community members help others by clicking Like or Select as Best on responses. Try it today.