Azure API管理REST API调用突然失败

编程入门 行业动态 更新时间:2024-10-25 08:14:38
本文介绍了Azure API管理REST API调用突然失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使我的API管理租户自动化,并突然在我的代码中收到"401未经授权"消息.有什么想法可以检测到为什么发生这种情况吗?

解决方案

查看一下您的请求中是否仍包含授权标头(可能会如此).在该处,您会看到一个查询字符串,如以& ex = [SOME DATA/TIME VALUE] 开头的值.像这样:

授权:SharedAccessSignature uid = 53dd860e1b72ff0467030003& ex = 2014-08-04T22:03:00.0000000Z& sn = ItH6scUyCazNKHULKA0Yv6T + Skk4bdVmLqcPPPdWoxl2n1 + rVbhKlf4c = Ch = Fc

这可能是过期的日期.在门户中或通过代码重新生成新的SAS.在Azure门户中,可以单击管理",在AAM门户中,单击安全",如下所述: msdn.microsoft/en-us/library/azure/dn798668.aspx#ProgrammaticallyCreateToken

I'm automating parts of my API Management tenant and suddenly receive '401 Unauthorized' messages in my code. Any ideas how I can detect why this is happening?

解决方案

heck to see if you still have an authorization header included in your requests (as probably will be the case). In there you see a querystring like value starting with &ex=[SOME DATA/TIME VALUE]. Like this:

Authorization: SharedAccessSignature uid=53dd860e1b72ff0467030003&ex=2014-08-04T22:03:00.0000000Z&sn=ItH6scUyCazNKHULKA0Yv6T+Skk4bdVmLqcPPPdWoxl2n1+rVbhKlplFrqjkoUFRr0og4wjeDz4yfThC82OjfQ==

This probably is an expired date. Regenerate a new SAS in the portal or through code. In the Azure portal you can click on Manage and in the AAM portal you click on 'Security', as described here: msdn.microsoft/en-us/library/azure/dn798668.aspx#ProgrammaticallyCreateToken

更多推荐

Azure API管理REST API调用突然失败

本文发布于:2023-08-01 16:39:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1269920.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Azure   API   REST

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!