Skip to content

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

@spalmcc

Description

@spalmcc

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

Refer the following image where the method details are there.
image

The main issue is, account is coming as null. Refer the following image:-
image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions