How to generate the access Token to access the Proxy Application using AcquireTokenSilent method.

Deshmukh, Ashish 1 Reputation point
2024-03-01T06:28:03.2433333+00:00

How to generate the access Token to access the Proxy Application using AcquireTokenSilent method.

I have used the AcquireTokenSilent method but the method returns null result.

Below is the code snippet

**var scopes = new string[] { todoListResourceId + "/user_impersonation" };

        AuthenticationResult authResult;

        //authResult = await clientApp.AcquireTokenSilent(scopes, account).ExecuteAsync();

        try

        {

            authResult = await clientApp.AcquireTokenSilent(scopes, account).ExecuteAsync();

            //authResult = await 

        }

        catch (MsalUiRequiredException ex)

        {

            authResult = await clientApp.AcquireTokenInteractive(scopes).ExecuteAsync();

        }**

Here in** authResult ** i am getting null result.

Thanks :)

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,307 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,339 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,740 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 72,996 Reputation points
    2024-03-02T16:06:58.98+00:00

    AcquireTokenSilent() is used to get the cached token tied to the users login identity. If expire and a refresh token is available, it will the refresh token to get the access token.

    this all requires the user has successfully authenticated and the token was stored. Also if a server farm, a distributed cache is required.

    show your configuration code for the initial authentication.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.