Reputation: 839
I'm making a function that gets new access token by refresh token,
const getAccessToken = async refreshToken => {
try {
const accessTokenObj = await axios.post(
'https://login.microsoftonline.com/common/oauth2/token',
querystring.stringify({
refresh_token: refreshToken,
client_id: 'xxxxx',
client_secret: 'xxxxx',
grant_type: 'refresh_token',
resource: 'https://graph.microsoft.com',
prompt: 'admin_consent'
})
);
return accessTokenObj;
} catch (err) {
console.log(err);
}
};
but when I run my code, I got this error:
The user or administrator has not consented to use the application with ID 'xxxxx' named 'xxxxx'. Send an interactive authorization request for this user and resource.
So I was following this tutorial to grant admin consent by I couldn't find Grant Admin Consent
button in my application.
What I was missing? I'm using a personal account to create an application.
Upvotes: 2
Views: 633
Reputation: 22429
You could follow below steps:
Note: With personal account you cannot get Grant Consent
Option. you should have tenant account. After that you can add Personal account for that operation. Better you can try with dedicated permission
Upvotes: 1