DavidC
DavidC

Reputation: 143

How to set up a Client Secret for a Native Client Application to access Azure Graph

I have developed a Native Client application that uses the Azure AD for authentication. I need to access some information using the AD Graph which requires a Client ID and Client Secret. I have added the application to my Azure active directory. I have added a reference to the Active Directory Authentication Library (ADAL) and installed the GraphAPI. The AquireToken of the Authentication context requires a Client ID (which I have) and a Client Secret (key), which I do not have. I have looked everywhere in the configuration of the application in the Azure portal and it appears that native applications do not have an option to set up a key. Web Apps do. Does anyone know how to set up and obtain a key for a Native Application?

Upvotes: 11

Views: 6347

Answers (2)

slavs
slavs

Reputation: 108

Native clients don't have the option to set up keys, only Web applications. I'm only new to this and stumbled upon the question because I was struggling with this myself. FYI, I have managed to use the Acquire Token successfully in the following way:

result = authContext.AcquireToken(ResourceId, clientId, redirectUri, PromptBehavior.Auto);

Where:
ResourceId e.g. https://examplename.onmicrosoft.com/ServiceName

clientId = e.g. 82692da5-a86f-44c9-9d53-2f88d52b478b

redirectUri = still haven't figured out how to use this but i used..
https://examplename.onmicrosoft.com/ServiceName

PromptBehavior.Always I set it as Always so I will always get the browser window to log in.

I hope this helps.

Upvotes: 4

Afshin
Afshin

Reputation: 226

You should create a Web application for your purpose. That is how you can create a confidential client which has both ID and Secret. Azure portal will generate the secret for you.

Upvotes: 7

Related Questions