-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Hello,
I allow myself to contact you because after setting up your solution everything works fine except that I block on the method refreshToken AuthService
When I make my request in http to retrieve the new token, the return executes before the request replies.
I am not very experienced in Angular so I think the solution is not difficult.
AuthService.ts
refreshToken(): Observable<any> {
let url: string = environment.API + "/auth/token/refresh";
let jwt = JSON.parse(localStorage.getItem('jwt'));
const query = {
'refresh_token': jwt.refresh_token
}
this.http.post(url, query).pipe(
map((newtoken) => {
localStorage.setItem('jwt', JSON.stringify(newtoken));
jwt = JSON.parse(localStorage.getItem('jwt'));
this.authTokenNew = jwt.token;
}));
this.currentToken = this.authTokenNew;
return observableOf(this.authTokenNew).pipe(delay(200));
}
Do you have a solution for me please ?
Metadata
Metadata
Assignees
Labels
No labels