我收到此错误:
Access to XMLHttpRequest at 'https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize/.well-known/openid-configuration' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
尝试重定向到 azure 进行登录时。
这是服务:
export class AuthService {
private _userManager: UserManager;
constructor(private http: HttpClient) {
const config = {
authority: Constants.stsAuthority,
client_id: Constants.clientId,
redirect_uri: `${Constants.clientRoot}assets/oidc-login-redirect.html`,
scope: 'openid profile',
response_type: 'id_token token',
post_logout_redirect_uri: `${Constants.clientRoot}?postLogout=true`,
userStore: new WebStorageStateStore({ store: window.localStorage })
};
this._userManager = new UserManager(config)
}
login(): Promise<any>{
return this._userManager.signinRedirect();
}
}
我确定我正确注册了我的localhost
网址。然而,我得到了那个错误。到目前为止,我没有看到任何处理该问题的文档。
感谢您的帮助