我正在尝试通过API访问天蓝色blob
在app.module中添加了配置:
MsalModule.forRoot({
clientID: 'myClientId',
authority: "https://login.microsoftonline.com/myClientId",
redirectUri: "http://localhost:4300/",
validateAuthority : true,
cacheLocation : "localStorage",
postLogoutRedirectUri: "http://localhost:4300/",
navigateToLoginRequestUrl : true,
popUp: true,
logger :loggerCallback,
correlationId: '1234',
piiLoggingEnabled: true,
unprotectedResources: ["https://www.microsoft.com/en-us/"],
});
在app.component中获得令牌
login() {
this.authService.loginPopup(["https://graph.microsoft.com/.default"]);
} // I'm not for sure that scope is correct
我正在尝试在服务中获取Blob(我的Blob是私有的):
httpGetRequest() {
const token = JSON.parse(sessionStorage.getItem('authToken'));
const headers = new Headers({
'x-ms-version': '2018-03-28',
'x-ms-date': (new Date()).toUTCString(),
'Authorization': 'Bearer' + token,
});
return this.http.get(this.url, new RequestOptions({headers: headers})).map((response: Response) => response.json());
}
我遇到403错误。