Trying to access a v2 endpoint hosted webapi but no luck, true if only graph api works on v2 now?

Viewed 115

Had a webapi running on v2 endpoint, the intent was to get access through a single call to both graph and the custom webapi, was using the v2 auth code grant flow, the url using as below,

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=14e9111f3e1-d220-415d-9bf4-d089f0b5feff&response_type=code&redirect_uri=https%3A%2F%2Flocalhost%3A8081%2Fartifactory%2Fwebapp%2Fsaml%2FloginResponse&response_mode=query&scope=api%3A%2F%2F14e9f3e1-d220-415d-9bf4-d089f0b5feff%2Faccess_as_user%20https%3A%2F%2Fgraph.windows.net%2Fuser.read%20openid%20offline_access&state=12345

with the scope as

api://14e9f3e1-d220-415d-9bf4-d089f0b5feff/access_as_user https://graph.windows.net/user.read openid offline_access

However, keep failing with a invalid scope error. If I take out the custom webapi from the resource, everything went through wonderfully.

Reading further, there is a limitation for webpi that

Web API can receive tokens only from an application that has the same Application ID. You cannot access a Web API from a client that has a different Application ID.

So I am confused, how to archieve the goal to use v2 endpoint to authenticate and get access to both graph and webapi????

--edit the error message is 'AADSTS65005: The application 'blah' asked for scope 'user.read' that doesn't exist on the resource. Contact the app vendor.'

1 Answers
Related