I'm currently working on a project where I have to extract data from an Azure function app endpoint through an angular 7 client application. This endpoint is protected with Azure Active Directory, and has been setup through the App registration (preview) UI.
This works very well, as I cannot seem to gain access to these endpoints what so ever now. I've tried with a token bearer through postman, and through the generated code from get url under the function app section. It's completely locked down. I get unauthorized every time.
Steps I've followed
I've setup my angular client as described here in the documentation with the MSAL library. I've used the v2 endpoint to setup my client app connection. I've then connected my function app endpoint via the App registration (preview). I've setup permissions and preauthorized my webapp using its client id - added redirect url to http://localhost:4200 - added the msal module to angular like this:
MsalModule.forRoot({
clientID: 'my-client-id',
redirectUri: 'http://localhost:4200',
consentScopes: [
'user.read',
'https://myapp.azurewebsites.net/user_impersonation'
]
}),
I've tried every possible combination of security setup through the Azure UI, though i'm quite new to Azure, (been working with it for 1 week), i'm close to saying i've been everywhere, not coming any closer.
Every single time i query my endpoint, i get a 401 Unauthorized with the message:
You do not have permission to view this directory or page.
I should add I run my angular website locally.
I do not get redirected to an authorization page even though I've set this up to be the case in the Azure UI - under Azure active directory protection.
I've tried several guides including this one which gives a good idea of what I've done in terms of steps.
I'm running out of ideas, anyone of you have had trouble with this?
EDITS
Server code that has to do with authorization:
public static async Task<HttpResponseMessage> RunGraphQLService([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, ILogger log)
As mentioned in the comments, I send the request to the service just fine, with Authorization: Bearer ey......something which is fine, except the api call is rejected still.
Screenshot of postman, minus sensitive information:

This was all I could think of to provide. As for more information.
Kind regards Chris