简体   繁体   English

Azure Active Directory身份验证

[英]Azure Active Directory Authentication

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. 我目前正在一个具有使用Azure Active Directory进行身份验证的Web API后端的项目中,并且正在使用Android移动应用程序中的该后端服务。 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. 简而言之,我已经在Azure AD中注册了一个客户端应用程序,并授予了它对Web API服务的所有权限。

From the Android app I cant get the access token which shows that I am able to log in using Azure AD. 从Android应用程序中,我无法获得访问令牌,该令牌表明我能够使用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. 当我在Postman上测试该服务时,我能够在本地成功命中该服务,但是在发布到Azure之后,当我尝试调用该服务调用时出现授权错误。 It worries me that locally it works properly and it doesn't on Azure. 令我担心的是,它在本地可以正常运行,而不能在Azure上运行。

What could be the possible solution to this? 有什么可能的解决方案?

I've managed to solve it at long last the yes Web config file was changing some keys after publishing. 我终于设法解决了它,是的,Web配置文件在发布后更改了一些键。 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. 由于我的服务在本地工作,因此我去了azure(应用程序服务>我的Web API服务>应用程序设置)在本地Web配置文件中输入内容,然后将它们添加到应用程序设置的azure上。

I really don't understand why azure is overriding keys after publishing. 我真的不明白为什么Azure在发布后会覆盖键。 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 . 因此,我了解到,我始终必须将azure上的Web配置文件与本地文件进行比较,并且还必须将我的Web API服务的所有重要密钥添加到azure Web API服务中的应用程序设置上,发布时更改。

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. 只是不幸的是😔我没有足够的代表来附加我在天蓝色时所做的屏幕截图的图像,以帮助其他经历相同问题的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows Azure Active Directory身份验证在Android中? - Windows azure active directory authentication in android? Azure Android SDK-Active Directory身份验证-如何获取角色? - Azure Android SDK - Active Directory Authentication - How to get Roles? 通过多个客户端对Active Directory进行身份验证 - Authentication with Active Directory by multiple clients Azure Active Directory身份验证库-在Google Pixel(Android Nougat 7.1.1)中不起作用 - Azure Active Directory Authentication Library - not working in Google Pixel (Android Nougat 7.1.1) 有没有一种不同的方式来访问android平台中的AD(Windows Active Directory身份验证),而不是LDAP / Azure - is there a different way to access AD (Windows Active Directory Authentication) in android platform instead of LDAP/Azure 使用Active Directory Azure库访问任务 - Access tasks using Active Directory Azure Library 如何从Azure Active Directory检索用户信息 - How to retrieve user information from Azure Active Directory 如何在Azure Active Directory中创建Native Client Application单租户? - How to make Native Client Application single tenant in Azure Active Directory? 如何使用ADAL从Azure Active Directory获取用户角色 - How to obtain user roles from Azure Active Directory using ADAL MSAL.Android:具有WebView的Azure Active Directory B2C授权 - MSAL.Android: Azure Active Directory B2C Authorization with WebView
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM