I have an angular 9 application + spring service which are authenticated against keycloak. The problem is that i want to open the spring swagger link in a new tab from the angular ui. Currently I am trying to add the bearer token to the authorization header when calling the url, but without much luck.
This is a snippet of what i am trying
var currentUserObject = JSON.parse(sessionStorage.getItem('currentUser'));
this.http.get(this.swaggerUrl, {
headers: new HttpHeaders({
'Authorization': 'Bearer ' + currentUserObject.access_token
})
}).subscribe(() => window.location.href=this.swaggerUrl)
}