adal getCachedToken is always null

315 Views Asked by At

I would get cached token using 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

The token value is always null, I have specified the ressource uribut it's not working.

I checked my localstorage I have the token

1

There are 1 best solutions below

0
On

You might try opening an issue in Github, or upgrading to MSAL now that ADAL is being deprecated.