Azure ADAL Refresh id_token

て烟熏妆下的殇ゞ 提交于 2019-12-05 18:05:58

In general you cannot use a refresh_token to renew an id_token because an id_token represents user authentication, information that cannot be refreshed without the user present. The way to refresh an id_token is described in the Session Management draft of OpenID Connect (http://openid.net/specs/openid-connect-session-1_0.html) i.e. by sending the user (agent) off to the authorization endpoint again with an authentication request that may include "prompt=none" if you want no user interaction but just check with the OP for an existing SSO session.

The Session Management capability as described in the draft spec is supported by Azure AD. If you want to synchronize the OP session with your application session that is the way to go. OTOH you may choose to have an application session that independent of the OP session, using it's own session timeout and duration, in which case there's no reason to refresh the id_token. The id_token is then only use to bootstrap the application session which then lives on it's own.

Also: the AcquireTokenByRefreshToken is really a manual fallback in case there's something in ADAL's automatic cache management that you don't want to execute. In general every call to AcquireToken* (apart from AcquireTokenByRefreshToken) will use the refresh token automatically if there's need and a valid one in cache. Unless you are really in special cases, I would advise against ever using AcquireTokenByRefreshToken

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