refresh token support

This commit is contained in:
2021-09-03 19:31:46 +02:00
parent 65d10685a4
commit 2312f21d77
2 changed files with 41 additions and 9 deletions

View File

@ -17,8 +17,11 @@ export class AuthHandlerInterceptor implements HttpInterceptor {
constructor(private tokenService: TokenService, private messageService: MessageService) {}
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
const token = localStorage.getItem(TokenService.Id_Token_Key)
const token = localStorage.getItem(TokenService.Id_AuthToken_Key)
if (request.url.includes(serviceBaseUrl) && token) {
this.messageService.add("start refresh of tokens")
this.tokenService.refresh()
this.messageService.add("api request intercepted")
const clone = request.clone({
setHeaders: { Authorization: `Bearer ${token}`}