I'm trying to call my ASP.NET Core Web API from a Vue3 app.
I have used the "connected services" in ASP.NET to configure AAD integration.
It has added the following code:
Program.cs
builder.Services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"))
.EnableTokenAcquisitionToCallDownstreamApi()
// .AddMicrosoftGraph(builder.Configuration.GetSection("MicrosoftGraph"))
.AddInMemoryTokenCaches();
appSettings.json:
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"TenantId": "6a71XXXXXXf181",
"ClientId": "b4476dXXXXXXX16f069",
"Secret": "5b8XXXXX084caa",
"Domain": "JXXXXXX5.onmicrosoft.com",
"CallbackPath": "/signin-oidc",
"ClientSecret": "Nvq8QXXXXXXXXXW0dA4",
"ClientCertificates": []
},
When I call the API from Vue (with a bearer token attached in headers), I get a HTTP 401 error:
WWW-Authenticate: Bearer error="invalid_token", error_description="The signature is invalid"
I have tried every sample I can find...but cannot get past this error.
Does anyone have a direction I can go in? Is this something wrong with App Registration?
Thanks in advance