Replies: 1 comment
-
Any update on this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have tried using tokens and Thumbprint. It only works for my machine with Thumbprint. I'm wanting to have it so i can run as System on a server and edit SharePoint files.
When i try a accesstoken it comes with access denied. Thumbprint works on my account but not other accounts.
What is the best way to create an Azure app and connect with edit permissions on a site but allow multiple accounts to run it.
This code lets me connect but everything i've tried is access denied.
#Authenticate and connect to Microsoft Graph
$tokenBody = @{
Grant_Type = "client_credentials"
Scope = "https://graph.microsoft.com/.default"
Client_Id = '######'
Client_Secret = '#######
}
$SiteURL = "https://#####.sharepoint.com/sites/######"
$tokenResponse = Invoke-RestMethod -Uri "https://login.microsoftonline.com/#######/oauth2/v2.0/token" -Method POST -Body $tokenBody
Connect-PnPOnline -Url $SiteURL -AccessToken $tokenResponse.access_token
Get-pnpweb
Error is: "Get-pnpweb : The remote server returned an error: (401) Unauthorized"
Beta Was this translation helpful? Give feedback.
All reactions