I have a property token
, I would like to initialize it in a calback of a method.
Unfortunately, I got this message
Cannot set property 'token' of undefined
when I try to put the value of access_token
in the property token
public token:string = "";
signInAction(){
new Oidc.UserManager(this.config).signinRedirectCallback().then(function (user) {
console.log(user.access_token);
this.token = user.access_token;
}).catch(function (e) {
console.error(e);
});
}
Any idea why.