WAAD 不会从 javascript 刷新访问令牌 [英] WAAD doesn't refresh access token from javascript

查看:21
本文介绍了WAAD 不会从 javascript 刷新访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于使用 Windows Azure Active Directory(WAAD) 对用户进行身份验证的应用程序,无法从 javascript 刷新令牌.

For applications that authenticate users with Windows Azure Active Directory(WAAD), unable to refresh token from javascript.

所有资源都受 Authorize 属性保护,如果令牌过期,则调用 login.windows.net/{0}.如果请求来自页面加载,它会按预期工作,但如果请求来自 javascript ajax 调用,则无法调用 login.windows.net/{0}.它返回状态 302 和消息

All the resources are protected by Authorize attribute makes calls to login.windows.net/{0} if token is expired. If the request is from page load it works as expected but if the request is from javascript ajax call it is unable make call to login.windows.net/{0}. It returns with status 302 and message

XMLHttpRequest 无法加载 https://login.windows.net/xxx.请求的资源上不存在Access-Control-Allow-Origin"标头.因此,Origin 'xxx' 不允许访问.

XMLHttpRequest cannot load https://login.windows.net/xxx. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'xxx' is therefore not allowed access.

如何从 javascript 调用中刷新令牌?

How to refresh the token from javascript calls?

推荐答案

看起来您使用更适合 Web UX 的方法来保护您的 Web API.看看 ADAL JS 以更可靠地处理 javascript 驱动的应用程序:http://www.cloudidentity.com/blog/2014/10/28/adal-javascript-and-angularjs-deep-dive/有关令牌更新如何工作的说明,请参阅该帖子中链接的视频高温高压五、

It looks like you secured your web API with a method more suited for web UX. Take a look at ADAL JS for a more reliable way of dealing with javascript driven apps: http://www.cloudidentity.com/blog/2014/10/28/adal-javascript-and-angularjs-deep-dive/ For an explanation of how token renewal works, see the video linked in that post HTH V.

这篇关于WAAD 不会从 javascript 刷新访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆