Partner-Center-PowerShell: New-PartnerAccessToken does not returns refresh token
Steps to reproduce
What steps can reproduce the defect? Please share the setup, commandline for vstest.console, sample project, target framework etc.
Refresh Token was issued with commands in v 1.5 of the module. It follows the standard way of creating SP, creation impersonation with the SP of a user that has global administrator and admin agent rights. Nothing out of the ordinary.
$p=New-PartnerAccessToken -ApplicationId "<app id>" -Credential (Get-Credential) -RefreshToken $token -Scopes 'https://api.partnercenter.microsoft.com/user_impersonation' -ServicePrincipal -Tenant <tenant id>
$p.RefreshToken
$p.RefreshToken is empty. Only access token is filled.
Expected behavior
Share the expected output Expected output should contain Refresh token
Actual behavior
What is the behavior observed?
No refresh token is returned, only access one.
Diagnostic logs
Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.
Environment
Please share additional details about your environment. Version
Both 5.1 and 6.2.3
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 39 (10 by maintainers)
@slavizh thank you for sharing that. There should be a file named
msal.cachein that directory. I am not sure what is happening just yet, but that is the reason the refresh token value is missing. The token cache is not persisting to storage. I was able to reproduce the issue and then I got it corrected in my environment. Let me keep digging to see what is causing this inconsistent behavior.@bilalAchahbar the root cause for this issue was related to how the module was being published. Since you have updated to a version where this has been corrected and your are still having issues please open a new issue. If you do open a new issue please include details about what exactly is missing.
That was definitely it. Thank you, sir!
Awesome that is great news. It was a rather interesting issue, but the good news it is resolved now. Thank you for bearing with me while I worked to get everything sorted.
@isaiahwilliams I have verified that version 2.0.1909.5 produces token. Thank you for fixing this!
@slavizh thank you for sharing this information. Just to confirm the refresh token value was still missing when you ran the command with this version correct?
@isaiahwilliams We have automation that renews tokens every day. We cannot migrate if we are not able to run it. ran the new version. refresh token is still not available. Debug is below:
@isaiahwilliams Several days have passed and the only update was merged that didn’t fixed the issue. Is the issue is investigated? Do we need to provide more information? When we can expect a fix?
Same here, issue still persists.
Haven’t tested that but it is useless to test it if refresh token does not work.
Thanks for testing it.
You were 150% right mate:
It has got nothing to do with what is setup in your App but everything to do with the code inside the command.
When I run the “fixed” code and check in fiddler:
So when we run this:
We get:
But API is returning the Refresh Token correctly (see Fiddler) but the command is written in a way so it does not.
If I put reply url https://localhost as well I can do interactive authentication. Seems you have changed the reply URL. Can you set it back to urn:ietf:wg:oauth:2.0:oob so we do not have to change our apps?
I still cannot get refresh token even when I have made this change,
I have not managed to test it yet since the new release but I bank my money @slavizh is correct. Plus the issue of not being able to cancel is so annoying it is beyond belief… especially that the new module is so broken that you end up testing all of it 530403403400 times a day - needed to restart everything each time…
BTW when problems happen in the broswer you can never cancel the command on the PowerShell window. You should have some time out or ability to cancel the command otherwise I have to close the whole window.