Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

Authenticate API App from console app with AAD

$
0
0

I have an API App registered with AAD. The API app is setup correctly. If I use browser (incognito) to go to

apiAppResource/login/aad

all works fine, login prompt to my account, session good.

I can then access the API APP by browsing to

apiAppResource/values

and I get data from the API APP.

What I want to do is use a console app to get the data from the API APP. I registered the console app as a native client application in AAD.

Q1: correct that console app should be a native client application and not web application?

Q2: in example I found, the console app in AAD has redirect uri of http://localhost. Is that correct?

Running the console app, I assume that I want to get the AuthenticationResult. This is where my confusion really sets in.

Q3: Would I use AuthenticationContext.AcquireToken(string resource, string clientId,  Uri redirectUri) and if so

Q3a: is the resource the API app or console app?

Q3b: is the clientId the id of the API app or console app?

Q3c:  is the redirectUri the redirectUri of the API app or console app?

After getting that token, I would do something like:

APIApp apiApp=new APIApp(); // create instance of api app

apiApp.Credentials=new TokenCredentials(authenticationResult.AccessToken); // set credentials for api app

apiApp.Values.Get(); // get data

Can someone please guide me in the right direction? Thanks


Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>