Replies: 1 comment 1 reply
-
hey @me1299 , this is a SharePoint online limitation. You need to use certificate authentication for app-only connection to SharePoint online. We support that using Connect-PnPOnline as mentioned below: https://pnp.github.io/powershell/cmdlets/Connect-PnPOnline.html#example-5 Client ID + Secret is not supported by SPO. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Issue Description
When attempting to authenticate to SharePoint Online using an MSAL token with
Connect-PnPOnline
, the command runs without errors, but all subsequent PnP commands return a 401 Unauthorized error.Using
Connect-PnPOnline -UseWebLogin
works as expected.Expected Behavior
When authenticating using an MSAL token, PnP commands should execute successfully with the expected permissions, just like when using
-UseWebLogin
.Actual Behavior
Does not return an error. However, running any subsequent PnP cmdlets results in a 401 Unauthorized error. Additionally, the command executes instantly, which seems odd.
Using Connect-PnPOnline -UseWebLogin instead works fine.
The AccessToken has the right permission to access sites.

I have found several similar reports online regarding this issue, but none have provided an explanation as to why it is not working. This makes it difficult to determine whether the issue is due to a misconfiguration, a bug, or something else entirely.
Beta Was this translation helpful? Give feedback.
All reactions