Share via


Using Graph API version 2

Microsoft introduced Graph API v2 to make the authentication more user friendly

  1. You don't need an azure account for registering your app.
  2. With one API interface you can login using office (outlook/live) and work accounts
  3. You can control your app/ user permissions directly from your app

Please follow the below process to register your apps.

App Registration

The Graph API changed its authentication protocol for supporting Microsoft and work accounts in a single API call.

−      Create a new app in the below link

https://apps.dev.microsoft.com/?referrer=https%3a%2f%2fdeveloper.microsoft.com%2fen-us%2fgraph%2fgraph-explorer#/appList 

−      Add redirect Url from new platform, please select the “Allow Implicit Flow” while creating new platform .

−       Choose appropriate permission required by your app to communicate with AD tenant.

−      Generate New Password and copy it because it won’t be visible again.

−      ***Your Application Id will be the client Id and password will be the client secret for all the graph/ AD communications

−      Save the changes.

−      We should send the admin consent for approving the app permissions to your AD tenant, AD tenant admin has to open the below URL for approving the app permissions.

https://login.microsoftonline.com/{TenantName}/adminconsent?client_id={ApplicationId}&state=12345&redirect_uri={RedirectURI}

Tenenetname example: Contoso.onmicrosoft.com

Application Id : your appId

Redirect Uri : it is the same redirect your of your app under platform section.

Please update the above fields in the Uri before open it in browser.

 

For the programmers who are familiar with Graph API v1:

  1. Client Id will be the application Id
  2. Client secret will be the password
  3. Tenant will be same but you have to give the appropriate permissions to your app by sending and approving the admin consent

Requesting & approving the permissions for your app can be done by using the below URL

https://login.microsoftonline.com/{TenantName}/adminconsent?client\_id={ApplicationId}\&state=12345\&redirect\_uri={RedirectURI}