简体   繁体   English

在Azure上部署后授权不起作用

[英]Authorization doesn't work after deployment on azure

Im building a single page app with angularJS and WebApi 2. Im using OAuth bearer token authentication with Owin middleware. 我用angularJS和WebApi 2构建了一个单页应用程序。我在Owin中间件中使用了OAuth承载令牌认证。 While everything works on the localhost,after deployment to Azure I get 401 when trying to access my web api. 虽然一切都可以在localhost上运行,但是在部署到Azure之后,尝试访问Web API时得到401。

Is there additional config on azure? 在Azure上是否有其他配置? What should i do? 我该怎么办?

Thx in advance 提前Thx

How did you do your deployment to Azure? 您是如何部署到Azure的? Deploying to Azure requires a change in the apps' return URI, to match the new location. 部署到Azure需要更改应用程序的返回URI,以匹配新位置。 If you create a new entry for the app, instead of modifying the existing one with the new return URI, you will get a new clientID. 如果您为应用程序创建一个新条目,而不是使用新的返回URI修改现有条目,则将获得一个新的clientID。 Your backend API verifies incoming tokens based on the clientID value in its web.config: if the clietnID value changes and you don't update it in the web.config before deploying to azure, the token check will fail. 您的后端API根据其web.config中的clientID值来验证传入的令牌:如果clietnID值发生了变化,并且您没有在部署到azure之前在web.config中对其进行更新,则令牌检查将失败。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM