Last post Nov 02, 2019 09:37 AM by gary.f
Oct 29, 2019 11:37 PM|gary.f|LINK
I'm experimenting with the client side
blazor and I would like to create a token based authentication with azure ad
b2c. I have an Azure Function which
is protected with Azure Active Directory B2C. From Postman I can reach this function with the following steps:
1. I choose the Authorization "OAuth 2.0", Add authorization
data to "Request Headers" and then Get New Access token.
2. I fill the Get New Access Token form with the proper data and then I
request a token.
3. I get the token back and if this
is added to Authorization Header I have the permission to call my Azure Function.
So, from Postman everything is working great and I would like to implement it to my
Blazor Webassembly app. Do you have any idea how can I create the first two steps to work in my application?
Thank you for your help,
Oct 29, 2019 11:57 PM|bruce (sqlwork.com)|LINK
blazor’s HttpClient library will be using the browsers fetch api to make the calls postman did, so your code will be restricted just as the browsers a. This means you will need to configure CORS correctly.
Nov 02, 2019 09:37 AM|gary.f|LINK
Thank you for your answer! I found out that indeed the CORS was the problem. The B2C OAUTH provider does not support the token acquiring from localhost. So, I created an azure function to do the token request process and pass the jwt token back to my web
client. It works this way!