question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New-PartnerAccessToken does not returns refresh token

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:39 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Sep 20, 2019

@slavizh thank you for sharing that. There should be a file named msal.cache in 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.

1reaction
ghostcommented, Nov 26, 2019

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not getting new refresh token using ...
Steps to reproduce Using PartnerCenter module version 3.0.10 on Windows Server Core, run the New-PartnerAccessToken command.
Read more >
New-PartnerAccessToken (PartnerCenter)
The third command will generate a new access token using the service principal credentials stored in the $credential variable and the refresh token...
Read more >
Release notes for Partner Center PowerShell
Authentication. Address issue #156 where the refresh token was not being returned if it had not been previously used by the module during...
Read more >
Understanding Refresh Tokens
Some of the reasons a refresh token may no longer be valid include: the authorization server has revoked the refresh token. the user...
Read more >
Getting new Secure App Model tokens
This script allows you to retrieve new tokens, you can use these tokens in CIPP or different locations. When using CIPP, you only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found