Azure App Proxy Bearer Token

Darius Basznianin 1 Reputation point

My use case is to authenticate to azure proxy app from client api.
I am able to get token for "app registration" (pic1), but my proxy app does not recognize that token (pic2).
On azure site I created app and gave permission to my azure proxy app for scope user impersonation
What I missed or if I should take different approach to achieve that?


Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,450 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Siva-kumar-selvaraj 15,601 Reputation points

    Hello @Darius Basznianin ,

    Thanks for reaching out.

    Here are detailed guidance on accessing published proxy application through Native application programmatically.

    To give your native app access to interact with published backend web API:

    To give your native app access to interact with published backend web applications:

    In addition to that, I could see you are using "Resource Owner Password Credentials (ROPC)" flow (grant_type=password) which is not recommends because in this flow user password sent in HTTP header which carries risks so try using more secure alternatives flows.

    This ROPC flow requires a very high degree of trust in the application, and carries risks which are not present in other flows. You should only use this flow when other more secure flows can't be used.

    Hope this helps.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

  2. Darius Basznianin 1 Reputation point

    When I took that example from ms page and adjusted configuration to my app it works.

    Great and thanks.

    0 comments No comments

  3. Darius Basznianin 1 Reputation point

    I have different question. An example native app uses below method to get token:

    var result = await authContext.AcquireTokenAsync(proxyId, appId, redirectUri, new PlatformParameters(PromptBehavior.Auto)); 

    Method acquires AccessToken, but who exactly is authenticated? Is there a way to authenticate specific user? I tried and do not see a way to do it.

    I tried also do it for client credentials and was able acquire token but it does not work for application proxy

    var result = await authContext.AcquireTokenAsync(appId, clientCredential); 

    How to acquite a token for native app but with client secret kwy or user and password?

    0 comments No comments

  4. Darius Basznianin 1 Reputation point

    I figured out how to authenticate as an user to client app. To do it during register client app you need to select account in this organizational directory and next in Authentication select "Enable public client flows".

    Next you need to adjust code to this version:

            var tenant = "xxx";  
            var appId = "xxx"; // app proxy  
            var clientId = "xxx"; // app  
            var proxyUrl = "";  
            var authContext = new AuthenticationContext($"{tenant}");  
            var securePassword = new SecureString();  
            foreach (var c in "xxx")  
            var result = await authContext.AcquireTokenAsync(appId, clientId, new UserPasswordCredential("", securePassword));  


    0 comments No comments