2017-03-21 37 views
1

我学习此代码示例:https://github.com/Azure-Samples/active-directory-dotnet-graphapi-web,是的,我可以在AuthorizationCodeReceived中获取访问令牌: AuthenticationHelper.token = result.AccessToken;如何获得刷新标记

但我如何获得刷新令牌?result.RefreshToken不可用,那么如何使用acquiretokenbyrefreshtoken函数?

https://msdn.microsoft.com/en-us/library/microsoft.identitymodel.clients.activedirectory.authenticationcontext.acquiretokenbyrefreshtoken.aspx

回答

1

的acquiretokenbyrefreshtoken功能可用在ADAL 2.X,该代码样品使用ADAL 3.13.8,和从ADAL3.X,库不会暴露刷新令牌和AuthenticationContext.AcquireTokenByRefreshToken功能。

ADAL缓存刷新令牌,并且每当你调用AcquireToken并且所请求的令牌需要更新(即使你想为不同资源获得新的访问令牌)时,它都会自动使用它。

请参阅here的说明。同时点击herehere以获取ADAL中刷新令牌的更多详细信息。

+0

感谢您的回答 – Phoenix

+0

请帮助我:http://stackoverflow.com/questions/43388851/the-azure-user-session-lifetime – Phoenix