Gerenios / AADInternals

AADInternals PowerShell module for administering Azure AD and Office 365
http://aadinternals.com/aadinternals
MIT License
1.24k stars 214 forks source link

Loading a Refresh Token into the cache? #16

Closed bridge-four closed 2 years ago

bridge-four commented 2 years ago

Just curious what the workflow is for loading in a refresh token that was retrieved offline? I want to use this with AADInternals to do follow on enumeration, but don't see options or cmdlets to load it into the cache. Appreciate the help!

NestoriSyynimaa commented 2 years ago

Whenever you get access token with -SaveToCache switch, refresh token is saved to cache and used to automatically renew access token when it expires: Get-AADIntAccessTokenForMSGraph -SaveToCache

You check the cache with: Get-AADIntCache

It will show the following:

Name            : user@company.com
ClientId        : 1b730954-1685-4b74-9bfd-dac224a7b894
Audience        : https://graph.windows.net
Tenant          : 2f4e92b2-de23-4fe1-aad0-f9b9d7c69f1e
IsExpired       : False
HasRefreshToken : True
AuthMethods     : {pwd, mfa}
Device          : 
codeitch commented 2 years ago

I just would like to refresh and follow-up a little on the original issue because it is fairly interesting. Since it is possible to obtain both access and refresh tokens independently from AADInternals, I would be interested to know whether there is any straightforward method for loading those tokens to the AADInternals toolkit afterwards?