$applicationId= 'xxxx-xxxx-xxxx-xxxx'
#App Secret ID and Value Provided Here
$credential = Get-Credential
#Directory (tenant) ID from APP Overview
$tenant = 'yyyy-yyyy-yyyy-yyyy'
$scope = 'https://api.partnercenter.microsoft.com/user_impersonation'
$token = New-PartnerAccessToken -ApplicationId $applicationId -Scopes $scope -ServicePrincipal -Credential $credential -Tenant $tenant -UseAuthorizationCode
It works till this point and I get both the AccessToken and a RefreshToken. I can use the AccessToken to connect to the Partner Center and all command works fine. The issue arose when I used the RefreshToken to get a new AccessToken
New-PartnerAccessToken : AADSTS700007: The grant was issued for a different client id. Trace ID: 2917c15e-6c7.. Correlation ID: 7f320e16-4297-4... Timestamp: 2023-11-29 06:26:32Z
At line:1 char:13
+ $newToken = New-PartnerAccessToken -ApplicationId 'xxxx-xxxx-xxxx-xx ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-PartnerAccessToken], MsalServiceException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerAccessToken
Expected behavior
Requesting new AccessToken using RefreshToekn should return same as it did using -UseAuthorizationCode
Actual behavior
Error as I am using the same app id, tenant id, secrets
`New-PartnerAccessToken : AADSTS700007: The grant was issued for a different client id. Trace ID: 2917c15e-6c7.. Correlation ID: 7f320e16-4297-4... Timestamp: 2023-11-29 06:26:32Z
Been stuck on this for days and I can't figure it out why this won't work. I doubt it may be an issue at the API endpoint.
Has anyone encountered the same issue and been able to overcome it? TIA
Steps to reproduce
It works till this point and I get both the AccessToken and a RefreshToken. I can use the AccessToken to connect to the Partner Center and all command works fine. The issue arose when I used the RefreshToken to get a new AccessToken
The error comes up as
Expected behavior
Requesting new AccessToken using RefreshToekn should return same as it did using -UseAuthorizationCode
Actual behavior
Error as I am using the same app id, tenant id, secrets
Environment
Been stuck on this for days and I can't figure it out why this won't work. I doubt it may be an issue at the API endpoint. Has anyone encountered the same issue and been able to overcome it? TIA