admin管理员组文章数量:1432453
I am developing an angular application in which I have integrated EntraID app for authentication and used the MsalInterceptor and configured the required providers as follows:
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: MsalInterceptor,
multi: true
},
{
provide: MSAL_INSTANCE,
useFactory: MSALInstanceFactory,
},
{
provide: MSAL_GUARD_CONFIG,
useFactory: MSALGuardConfigFactory
},
{
provide: MSAL_INTERCEPTOR_CONFIG,
useFactory: MSALInterceptorConfigFactory
},
MsalService,
MsalGuard,
MsalBroadcastService
]
This configuration works (adding required bearer token) for making http requests from service classes and for downloading the file as follows:
export class FileDownloadService {
constructor(private http: HttpClient) { }
downloadFile(url: string): Observable<Blob> {
return this.http.get(url, { responseType: 'blob' });
}
}
this.fileDownloadService.downloadFile(fileUrl).subscribe(
{
next:blob => {
const a = document.createElement('a');
const objectUrl = URL.createObjectURL(blob);
a.href = objectUrl;
a.download = file.fileName;
a.click();
URL.revokeObjectURL(objectUrl);
this.gridApi.deselectAll();
},
error: (error) => {
}});
However, it is not working (not setting the bearer token to the header) when the filePath was set as src for the img, video, audio and pdf viewers as follows:
<img [src]="filePath" />
Am I missing any configuration?
本文标签:
版权声明:本文标题:angular - MsalInterceptor is not setting the bearer token to the http requests made from the img, video, audio and pdf viewer co 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742006242a2412011.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论