Azure AD OAuth 2.0 Access Token has expired

Copper Contributor

For testing purposes it is sometimes usefull to revoke a STS token. On AD FS there are ways to do this e.g. Revoke-AzureADSignedInUserAllRefreshToken.

Is there a way to revoke an Azure AD sts token either on the Azure AD side or the client side e.g. by removing/deleting it from the client. Deleting cookies unfortunately doesn't work.

1 Reply

Hi Han,

 

Revoking a user’s active refresh tokens is simple and can be done on an ad-hoc basis. You do this by setting the StsRefreshTokensValidFrom on the user object, so any refresh tokens tied to a credential provided before the time this attribute was set will no longer be honored by Azure AD. The user will be forced to re-authenticate to receive a new refresh token.

Follow these steps to revoke a user’s refresh tokens:

  1. Download the latest Azure AD PowerShell V1 release.
  2. Run the Connect command to sign in to your Azure AD admin account. Run this command each time you start a new session:

    Connect-msolservice

  3. Set the StsRefreshTokensValidFrom parameter using the following command:

    Set-MsolUser -UserPrincipalName <UPN of the User> -StsRefreshTokensValidFrom (“<current date>”)

I hope this helps.

 

Best regards,

Ruud Gijsbers