For how long I can keep using the access token?

Zoharat Motiwala 21 Reputation points
2021-12-06T21:46:06.177+00:00

I use client credential authentication flow, and obtain the access token by using permissions granted to an application. I know this access token expires in an hour. But if I keep invoking the endpoint for the token can I get a new access token silently, without having the admin user log in again?

My process would be a daemon running in the background. I would like the admin to log in just once and approve the permissions and then I just invoke the token endpoint, will this allow tokens to be valid forever?

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
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 36,896 Reputation points
    2021-12-07T01:55:43.75+00:00

    Hi @Zoharat Motiwala

    But if I keep invoking the endpoint for the token can I get a new access token silently, without having the admin user log in again?

    Of course, the client credential flow based on the daemon does not require user or administrator involvement.

    I would like the admin to log in just once and approve the permissions and then I just invoke the token endpoint, will this allow tokens to be valid forever?

    Your administrator login is only to approve application permissions. In fact, the administrator does not participate in the client credential flow, so the client credential flow will not issue a refresh token, when the token expires you need to invoke the token endpoint again to get a new token. Of course, the new token will not be valid forever, it will expire in 1 hour.


    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 additional answers

Sort by: Most helpful