Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

Getting access token as AD B2C user in ASP .NET Core app

$
0
0

I have an  ASP .NET Core 2.2 web app that's using Azure AD B2C for authentication. My user flows are working correctly, users can sign up and sign on using custom flows.

My code follows this sample very closely: https://github.com/Azure-Samples/active-directory-b2c-dotnetcore-webapp

Issue is I keep getting unauthorized errors if I try to request an access token using the authenticated user ID and use it to make API calls.

I set up an Azure Function and it works perfectly using a web browser, redirecting to my custom sign on page for authentication and then executing correctly. But I get 401 error when trying to make an HTTP request to it using a bearer token I acquire this way: https://github.com/Azure-Samples/active-directory-b2c-dotnetcore-webapp/blob/6dbb7e83ddc1bdfae64e94292f0e400c88b93de7/WebApp-OpenIDConnect-DotNet/Controllers/HomeController.cs#L57

Any ideas?


Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>