Azure-Samples / Azure-Samples/active-directory-b2c-dotnet-webapp-and-webapi

Azure AD B2C - .NET-Web app calling web api - No account or login hint was passed to the AcquireTokenSilent call

Open
#149 22 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
282
Forks
236
PR merge metrics
No merged PRs in 30d

Description

Hello All,

We have configured web app and web api on Azure as per the sample code and instructions provided by Micosoft (https://github.com/Azure-Samples/active-directory-b2c-dotnet-webapp-and-webapi)

What is the issue? When I am trying to access the token in web controller, I am getting the following error: "No account or login hint was passed to the AcquireTokenSilent call."

Refer the following image where we can making a call to get the token.
![image](https://user-images.githubusercontent.com/127770345/230488616-6b3b5c6c-95e8-4c9f-b56d-c95a8d3adc2e.png)

Refer the following image where the method details are there.
![image](https://user-images.githubusercontent.com/127770345/230488677-40f99c5c-f5c5-44c6-a1e9-4f5d615960ab.png)

The main issue is, account is coming as null. Refer the following image:-
![image](https://user-images.githubusercontent.com/127770345/230488768-4a7848f2-7d4e-4353-a39f-eff1d7c94137.png)

We are not able to find where is the issue, why account is coming as null.

So I did the following to ensure web api is configured properly:-

Added one more redirect uri on Web Api on Azure (https://www.postman.com/oauth2/callback) for postman
Added all configuration in postman
Started the web api project locally
Manage to get access token
Able to hit one end point successfully to the web api(Get call)
Able one end point successfully to the web api (Post call)
So this test ensures that web api project is configured in Azure and working fine using Azure AD B2C Authentication.

I did a similar test by running a userflow againts the web api project and I could see tokens getting generated (Not sure if this is a legitimate test)

I have been reading the issue on internet.But not able to find an exact issue like this. Any pointers would be very hekpfull.
best regards

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.