Azure hosted api bearer tokens wont decrypt with context.DeserializeTicket?

我怕爱的太早我们不能终老 提交于 2019-12-24 17:29:09

问题


I have 2 webapi2 projects that use the same database. If I'm on localhost I get a bearer token from one I can pass it to the other and the other will properly decrypt it and load the user. However when I publish them to separate urls on azure, I get the one token fine from one but when I pass it to the other I can't get the ticket to load and it gives me the unauthorized response.

I'm testing this by watching the owin AuthenticationTokenProvider.OnRecieve method. When context.DeserializeTicket is called the ticket remains null and the user never gets loaded.

Your first response will likely be about how the machine keys need to be the same between the 2 so they will work. The problem there is

  1. All my online research says that azure machine keys are synced between apps in the same role (ones a web app and the other is a web api app) so this shouldn't be an issue
  2. I can't specify a machine key because the first app has been in production for a while and changing it's machine key would mess up stored passwords etc...
  3. using the machine key used by the production app on the new api nay work but there is no way to get the machine key of an azure web app.

I'm pretty sure this isn't a machine key issue though but I have no idea how to figure this out. Heeeeelllp!

来源:https://stackoverflow.com/questions/32828661/azure-hosted-api-bearer-tokens-wont-decrypt-with-context-deserializeticket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!