Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Yahoo端点和angular-oauth2-oidc时angular中的CORS策略错误_Angular_Cors_Openid Connect_Yahoo Api_Angular Oauth2 Oidc - Fatal编程技术网

使用Yahoo端点和angular-oauth2-oidc时angular中的CORS策略错误

使用Yahoo端点和angular-oauth2-oidc时angular中的CORS策略错误,angular,cors,openid-connect,yahoo-api,angular-oauth2-oidc,Angular,Cors,Openid Connect,Yahoo Api,Angular Oauth2 Oidc,我使用angular-oauth2-oidc在angular应用程序中实现授权代码流。主要的想法很简单,我只有一个带有登录按钮的应用程序组件。当用户单击它时,必须将其重定向/弹出到“身份验证提供商登录”页面,并在成功登录后返回应用程序 身份验证由以下服务处理: export class AuthenticationService { private authCodeFlowConfig: AuthConfig = { // Url of the Identity Provider

我使用angular-oauth2-oidc在angular应用程序中实现授权代码流。主要的想法很简单,我只有一个带有登录按钮的应用程序组件。当用户单击它时,必须将其重定向/弹出到“身份验证提供商登录”页面,并在成功登录后返回应用程序

身份验证由以下服务处理:

export class AuthenticationService {
  private authCodeFlowConfig: AuthConfig = {
    // Url of the Identity Provider
    issuer: 'https://api.login.yahoo.com/',
    
    redirectUri: window.location.origin + '/',
    
    // The SPA's id. The SPA is registerd with this id at the auth-server
    clientId: 'my-cliend-id',
    

    // Just needed if your auth server demands a secret. In general, this
    // is a sign that the auth server is not configured with SPAs in mind
    // and it might not enforce further best practices vital for security
    // such applications.
    dummyClientSecret: 'my-client-secret',

    responseType: 'code',

    // set the scope for the permissions the client should request
    scope: 'openid profile email',

    showDebugInformation: true
  };

  constructor(public oauthService: OAuthService) {
    this.oauthService.configure(this.authCodeFlowConfig);
    this.oauthService.loadDiscoveryDocumentAndTryLogin();
    
  }

  async login(){
    await this.oauthService.initLoginFlowInPopup();
  }
}
这会使我的应用程序运行,但当我尝试登录时,它会提供“在”处访问XMLHttpRequest的权限https://api.login.yahoo.com/.well-known/openid-configuration“起源”http://localhost:4200'已被CORS策略阻止:请求的资源上不存在'Access Control Allow Origin'标头。“控制台中。”。之后,我尝试在angular应用程序中使用代理设置解决问题,但没有解决问题,然后我还尝试制作自定义代理控制器,并在issuer中提供其url,但没有解决所有问题

我怀疑我做错了什么,因为我期望angular-oauth2-oidc会自动处理代码

我是不是遗漏了什么