PnP Core from API using OBO #1215
-
I am developing an API that will use PnP Core to retrieve info from SharePoint. I keep getting error --> Invalid JWT token: header is malformed. I have followed sample to build a service using PnP Core instead --> https://github.com/Azure-Samples/active-directory-dotnet-native-aspnetcore-v2/tree/master/2.%20Web%20API%20now%20calls%20Microsoft%20Graph What am I doing wrong? PnP Core OBO - I am doing below
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
@planetpallavi : This sample (https://spblog.net/post/2020/12/10/how-to-access-sharepoint-data-from-azure-function-with-spfx-and-pnp-core) shows how to use OBO from an SPFX web part. Looking at the code I noticed it passes the token as |
Beta Was this translation helpful? Give feedback.
-
Hello Jansenbe, Thank you for your reply. |
Beta Was this translation helpful? Give feedback.
-
Few additional queries though...
|
Beta Was this translation helpful? Give feedback.
-
So I did figure out eventually... The function needs the usertoken which can be retrieved by using AuthenticationHeaderValue.Parse(Request.Headers.Authorization).Parameter PnP OBO works like a charm... I also had this in my API service pipeline |
Beta Was this translation helpful? Give feedback.
So I did figure out eventually... The function needs the usertoken which can be retrieved by using AuthenticationHeaderValue.Parse(Request.Headers.Authorization).Parameter
PnP OBO works like a charm...
I also had this in my API service pipeline
builder.Services.AddMicrosoftIdentityWebApiAuthentication(config)
.EnableTokenAcquisitionToCallDownstreamApi()
.AddMicrosoftGraph(config.GetSection("DownstreamApi"))
.AddInMemoryTokenCaches();