I’m encountering an error in IntelliJ when trying to use decodedJwt.scope
.
The error message is: Property ‘scope’ does not exist on type ‘JwtPayload’.
The only suggestions IntelliJ provides are: sub, aud, exp, iat, jti, iss, and nbf.
loadProfile(data: any) {
this.isAuthenticated = true;
this.accessToken = data['access-token'];
let decodedJwt = jwtDecode(this.accessToken);
this.username = decodedJwt.sub;
this.roles = decodedJwt.scope;
window.localStorage.setItem("jwt-token", this.accessToken);
}
I’ve used decodedJwt.scope
many times before without any issues, but now it suddenly doesn’t seem to exist. Has anyone faced this issue before or knows how to resolve it?
New contributor
Mohamed Ali Dellai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.