Replies: 2 comments
-
Have you tried connecting to a site, then using Get-PnPAccessToken to fetch the current access token? You could then use that access token to connect again:
These tokens do tend to expire after an hour, so it may or may not be suitable for your use case. |
Beta Was this translation helpful? Give feedback.
-
...no I haven't. I wasn't aware of that Cmdlet. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Expected behavior
As documented for Disconnect-PnPOnline docco;
"If instead you simply want to connect to another site collection within the same tenant using the same credentials you used previously, do not use this cmdlet but instead use Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/othersite instead without disconnecting. It will try to reuse the existing authentication method and cached credentials."
Extra Question (for bonus points)
Is there a method of accessing and re-using the Authentication Details with an -interactive MFA connection?
I want to:
Actual behavior
IF you're using the Connect-PnPOnline -Interactive method, you're prompted for credentials again on attempting to connect to second site.
Steps to reproduce behavior
Including -interactive on the second connection string prompts for Web/MFA Authentication again.
(inclusion or omission of -ReturnConnection is irrelevant).
What is the version of the Cmdlet module you are running?
1.11.0
Which operating system/environment are you running PnP PowerShell on?
Beta Was this translation helpful? Give feedback.
All reactions