microsoft / Partner-Center-PowerShell

PowerShell module for managing Partner Center resources.
https://docs.microsoft.com/powershell/partnercenter/
MIT License
130 stars 59 forks source link

Error from New-PartnerAccessToken "Invalid URI : The URI string is too long" #333

Open EIG-Rosetta opened 3 years ago

EIG-Rosetta commented 3 years ago

When calling New-PartnerAccessToken using a refresh token that was obtained from an earlier call, we frequently see the error Invalid URI : The URI string is too long

Example call in the Powershell console:

> $token = New-PartnerAccessToken -Module ExchangeOnline -Verbose -Tenant 3MMwZCIn3aGbUglA87ze9P3RXcB.onmicrosoft.com -RefreshToken OAQABAA...
New-PartnerAccessToken: Invalid URI: The Uri string is too long.

The error does not seem to occur when the length of the token is shorter than some unknown amount. We do note that the refresh tokens are often extremely long -- the token that is currently in use for one of our tenants is 65,551 characters.