AADSTS70008: The provided authorization code or refresh token has expired due to inactivity

Maxine Widemann 36 Reputation points
2021-11-24T16:17:17.667+00:00

Hi,

I am trying to set up an API connection with Microsoft Graph in order to automate our employee onboarding process (i.e. create a user in microsoft 365). After registering the app and defining the permissions, I am stuck at the authorization and authentication step.

Namely, when sending an interactive authentication request, I obtain a code which I then use to request an acces token. However, I directly get the following error message:
AADSTS70008: The provided authorization code or refresh token has expired due to inactivity. Send a new interactive authorization request for this user and resource.

How is it possible when I have just created the app and not been able to obtain a token yet?

Any help is appreciated !

Maxine

Microsoft Security | Microsoft Authenticator
Microsoft Security | Microsoft Graph
{count} votes

Accepted answer
  1. CarlZhao-MSFT 46,376 Reputation points
    2021-11-25T02:08:11.737+00:00

    Hi @Maxine Widemann

    1.This is an error caused by the api tool, you can switch to postman to get the token.

    2.When creating a user, you must ensure that the user you log in is granted at least the role of user administrator.

    152716-image.png

    152735-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.