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

Maxine Widemann 31 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 Authenticator
Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
5,490 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,585 questions
{count} votes

Accepted answer
  1. CarlZhao-MSFT 36,896 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