0
votes

I am currently working on a project that has a web API back end that is authenticated using Azure Active Directory, and I am consuming that back end service from an Android mobile app. To cut a long story short, I have registered a client app in Azure AD and granted it all the permissions to the web API service.

From the Android app I cant get the access token which shows that I am able to log in using Azure AD. The problem is that I get an authorization error whenever I try to invoke the service calls using the access token.

When I test the service on Postman, I am able to successfully hit the service locally, but after publishing to Azure, I get an authorization error when I try to invoke the service calls. It worries me that locally it works properly and it doesn't on Azure.

What could be the possible solution to this?

1
Have you enabled the App Service Authentication / Authorization feature ? And please also check whether any configuration changed after publishing .Nan Yu
You say: "From the Android app I can't get the access token...". Did you mean "From the Android app I can get the access token..."?Philippe Signoret
Yes the configs wher changing but I have eventually managed to solve them thank you.Mossco

1 Answers

0
votes

I've managed to solve it at long last the yes Web config file was changing some keys after publishing. I went to azure (App Service > My Web API service >App settings ) to enter the ones on my local Web config file since my service was working locally and add them on azure on the app settings.

I really don't understand why azure is overriding keys after publishing. So I've learned that I always have to compare the Web config file on azure with the one locally and to also add all the important keys of my Web API service on the app settings in azure Web API service in that way they won't change when publishing .

It's just unfortunate 😔 I don't have enough rep to attach images of screen shots of what I did on azure to help others experiencing the same issue.