Gerenios / AADInternals

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

Get-UserPRTToken sometimes retrieving the wrong token #75

Closed skorov closed 6 months ago

skorov commented 9 months ago

In some cases, Get-UserPRTToken will retrieve the x-ms-DeviceCredential cookie/token instead of the expected x-ms-RefreshTokenCredential token.

This causes the following documented workflow to fail: https://aadinternals.com/aadinternals/#get-aadintuserprttoken

image

Digging into the issue a bit more...

image

The fix here is to find the correct index of x-ms-RefreshTokenCredential and return that token. With the fix, the above workflow works. 🙂

image

Please go ahead and make any corrections I might have missed.

Cheers!