Replies: 2 comments
-
I have the same issue, anyone? Running 1.12.0. |
Beta Was this translation helpful? Give feedback.
-
I have the same for Get-PnPAccessToken. According to the documentation it allows SharePoint API & CSOM connections. After getting the token I get the same error for this command: Get-PnPWeb I'm using PnP 2.2.0 and PowerShell 7.3.5. Connect-PnPOnline https://tenantname.sharepoint.com -Interactive Loop over certain sites to change something, for example. With the same user I'm able to connect to the same site using this, so the user has access and the correct permissions: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I would like to connect using an access token, but is does not work for me. I don't know if this is a bug or if I am doing something wrong.
I am using 1.11.0 PnP.PowerShell with Powershell 7.2.7 in macOS 12.6.1.
When I connect using Device login (Connect-PnPOnline -Url "" -DeviceLogin) everything works fine. However when switching between sites I have to enter the device code all the time.
I try to get a token and then use it to connect to other sites:
$token = Get-PnPAccessToken
Connect-PnPOnline -Url "" -accesstoken $token
I don't get any error messages. But when I try to access anything I get "The remote server returned an error: (401) Unauthorized."
It works using -devicelogin, so my permissions in general are correct.
I also tried
$token = Get-PnPAccessToken -ResourceTypeName SharePoint
, but this did not help as well.I did not find any example online how to use tokens to get connected.
best regards
Joerg
Beta Was this translation helpful? Give feedback.
All reactions