-
Hi, We are trying to replicate the AccessToken you get when using 'Connect-PnPOnline -Interactive; Get-PnPAppAuthAccessToken' through a separate application. We manage to create the AccessToken with 'https://yourTenantSite.sharepoint.com' as the resource for the token and O365 SharePoint Online AllSites.FullControl scope, but we are still getting 401 after connecting successfully and trying to run Get-PnPSite or Get-PnPWeb etc. This is what we are using as of now. $params = @{ $customerAccessTokenUri = ('https://login.microsoftonline.com/YourTenantID/oauth2/v2.0/token') Connect-PnPOnline -Url $RootURL -AccessToken $AccessToken When decoding the token we receive, the scope shows the following: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @magnusjak, If you are retrieving a token with the audience (aud) "https://yourtenantsite.sharepoint.com/", you'll not be seeing the Microsoft Graph scopes, you'd need to request a token for the microsoft graph to do that. (The resource value being Further more: If you like to communicate using App only permissions, you'd need to apply for the |
Beta Was this translation helpful? Give feedback.
-
Hi @martinlingstuyl, We ended up doing a workaround here. Using our DAP(AOBO) access to create an application/ServicePrincipal and add the required permissions to it, add a certificate and then save the appID and certEncoding in our own keyvault, we are able to use this when authentication to the customer through PNP. We also had a discussion with Microsoft about this, more or less saying that it won't work using the DAP access directly. |
Beta Was this translation helpful? Give feedback.
Hi @martinlingstuyl,
We ended up doing a workaround here. Using our DAP(AOBO) access to create an application/ServicePrincipal and add the required permissions to it, add a certificate and then save the appID and certEncoding in our own keyvault, we are able to use this when authentication to the customer through PNP.
We also had a discussion with Microsoft about this, more or less saying that it won't work using the DAP access directly.