angular-11-spring-boot-jwt-authentication
angular-11-spring-boot-jwt-authentication copied to clipboard
"auth-token" null in SessionStorage
Hello,
I have seen a little error for the "auth-token" SessionStorage.
In frontend (File login.component.ts):
this.authService.login(username, password).subscribe(
data => {
this.tokenStorage.saveToken(data.accessToken);
this.tokenStorage.saveUser(data);
In backend (File JwtResponse.java):
@Data
public class JwtResponse {
private String token;
private String type = "Bearer";
So, in frontend accessToken should be changed to token (Or in backend change token to accessToken).