【问题标题】:adal getCachedToken is always nulladal getCachedToken 始终为空
【发布时间】:2020-10-17 01:56:38
【问题描述】:

我会使用 react-adal api 获得缓存的令牌

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

令牌值始终为空,我指定了ressource uri,但它不起作用。

我检查了我的本地存储,我有令牌

【问题讨论】:

标签: javascript reactjs adal adal.js


【解决方案1】:

您可以尝试 opening an issue in Github,或升级到 MSAL,因为 ADAL 已被弃用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-31
    • 2019-07-18
    • 2019-08-18
    • 2011-12-29
    • 2019-07-02
    • 2019-05-04
    • 1970-01-01
    • 2011-05-04
    相关资源
    最近更新 更多