1
votes

I am creating a mobile application and a web api. The mobile app will access the web api using the token obtained.

I have created a mobile application using the portal "https://apps.dev.microsoft.com/" and a Web App/API using the Applications under Azure Active Directory. Both these were created using a Global admin of the tenant.

When I try to login into the mobile app, with the App Id of the web api as scope, I am getting below error.

The application named [ABC] was not found in the tenant named [XYZ].onmicrosoft.com

The native client is not able to find the web api.

Any pointers on what could be the problem here ?

1
I also tried creating the native application here under App Registrations and adding the permissions for web api to the native client application. But when I run the application in mobile, I get the error The application [DEF] is not supported for this API version. - V. G.

1 Answers

1
votes

AFAIK , currently you can't call web api which protected by Azure AD V1.0 endpoint from client app app that uses the v2.0 endpoint in the Microsoft Application Registration Portal. You could create the client app in azure portal under App Registrations, and add/grant permission to access your web api app .

The error The application [DEF] is not supported for this API version could be reproduced by using v2.0 endpoints to acquire token in azure ad v1.0 app:

https://login.microsoftonline.com/common/oauth2/v2.0/authorize
https://login.microsoftonline.com/common/oauth2/v2.0/token

You should create requests to below endpoints in azure ad v1.0 app(register in azure portal):

https://login.microsoftonline.com/{tenant}/oauth2/authorize (single tenant)
https://login.microsoftonline.com/{tenant}/oauth2/token(single tenant)

And set resource parameter ,the App ID URI of the web API (secured resource)) in your scenario, when acquiring token for your web api . Please check these code samples for how to call web api in native app in azure ad