question

JustinRaj-3254 avatar image
0 Votes"
JustinRaj-3254 asked

Microsoft Graph API ERROR:unauthorized_client

I have registered APP in Azure Portal and successfully generated credentials in Microsoft Graph API. after outlookmail.init Operation in WSO2 EI, i am getting below ERROR.

ERROR:

 {"error":"unauthorized_client","error_description":"AADSTS700016: Application with identifier 'a4935017-80e8-4413-a762-780b32d8f968' was not found in the directory 'e5e67d60-adf4-40b4-883c-351dc2feef4e'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.\r\nTrace ID: 4ecb19d5-e66b-40c1-9a15-7237a0d4c801\r\nCorrelation ID: 818ba54d-f5e5-43df-9201-96d71f598b1f\r\nTimestamp: 2021-07-08 10:14:35Z","error_codes":[700016],"timestamp":"2021-07-08 10:14:35Z","trace_id":"4ecb19d5-e66b-40c1-9a15-7237a0d4c801","correlation_id":"818ba54d-f5e5-43df-9201-96d71f598b1f","error_uri":"https://login.microsoftonline.com/error?code=700016"}

Application in Azure Portal:

Registration APP

I have seen error code in this site which says like below.

 This usually occurs when the client application isn't registered in Azure AD or isn't added to the user's Azure AD tenant. The application can prompt the user with instruction for installing the application and adding it to Azure AD

Can anyone please help me to resolve this?


azure-active-directorymicrosoft-graph-mail
image.png (106.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

michev avatar image
0 Votes"
michev answered JustinRaj-3254 commented

The application identifier mentioned in the error message above seems to be different from the one shown on the screenshot, so double-check your code - you might have forgotten to replace some value. When requesting a token, make sure to use the application (client) ID value.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @michev

Thanks for your reply. As you suggested i have reviewed my app list that contains app id as "a4935017-80e8-4413-a762-780b32d8f968". It is old app that is in Deleted App list. In my Code also i have provided the exact client ID which is shown in above screenshot.

Deleted APP List:
Deleted APP

May i know the reason why it is taking old deleted APP Client ID? Or else what i need to do in this case?


0 Votes 0 ·
image.png (136.6 KiB)

Not sure, you'll have to take a closer look at the code, or share the sanitized "get a token" function here.

0 Votes 0 ·

Hi @michev

I have mentioned each and every step that i followed to generate credentials in below raised question.

to-get-refreshtoken-accesstoken-in-microsoft-graph-api


0 Votes 0 ·