403 error when making call to get emails [React-Native AXIOS]

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}](https://${youroktadomain}/idp/myaccount/emails/$%7BidToken%7D),

headers: headers

}).then((response) => {

console.log(response.data);

}).catch((err) => {

console.error(err);

});

The ID at the end should be the ID of the email you’re trying to read, as per our API docs. If you don’t know the email ID, can you try GET’ing all the emails for the user with the URL https://oktaDomain/idp/myaccount/emails?