adal getCachedToken始终为null

问题描述

我将使用react-adal api获取缓存令牌

CanExecute

令牌值始终为空,我指定了import { authContext,} from '../auth' const AvatarContainer = () => { getPersonPhoto(authContext) return ( <Avatar /> ) } async function getPersonPhoto(authContext) { const user = await authContext.getCachedUser(); const token = authContext.getCachedToken('https://graph.microsoft.com') console.log("the token",token) var photoUrl = "https://graph.microsoft.com/v1.0/users/" + user.profile.aud + "/photo/$value"; var Avatar = null; // try { // Avatar = await client // .api(photoUrl) // .get(); // return Avatar; // } catch (e) { return null; } } export default AvatarContainer ,但它不起作用。

我检查了本地存储中是否有令牌

解决方法

由于不建议使用ADAL,您可以尝试opening an issue in Github或升级到MSAL