使用刷新令牌Adal JS获取新的访问令牌 [英] Acquiring new access token using refresh token adal js

查看:88
本文介绍了使用刷新令牌Adal JS获取新的访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用在Azure广告中进行身份验证的应用程序。我使用adal.js来获取访问令牌。但是访问令牌仅在1小时内有效。那么,如何使用Adal js中的刷新令牌在后台获取新令牌?

I am working with an application that authenticate in azure ad. I use adal.js to acquire access token. But the access token is only valid for 1 hour. So how can I acquire new token behind the scene using my refresh token in Adal js?

感谢您提供示例代码。

推荐答案

当用户与Azure AD进行活动会话时,ADAL JS会自动为您执行该会话。 ADAL JS检查现有令牌(在缓存中)的预计过期时间,如果令牌即将过期,它将使用不可见的iFrame将新令牌(续订)请求发送到Azure AD。

As long as the user have an active session with Azure AD, ADAL JS does it automatically for you. ADAL JS examines the projected expiration of the existing token (in the cache) and if the token is about to expire, it uses an invisible iFrame to send a new token (renewal) request to Azure AD.

对此进行了详细讨论 Vittorio在这里(带有示例代码)和此处

This is discussed in detail here (with sample code) by Vittorio and the mechanics of silent renewal is discussed here.

这篇关于使用刷新令牌Adal JS获取新的访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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