Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.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
在OAuth使用散列重定向之后,Angular SPA不会';t加载svg';s如果下一个http调用失败,选项状态为0 conn REPENDED?奇缘案 正常行为_Angular_Angular Router_Angular Oauth2 Oidc - Fatal编程技术网

在OAuth使用散列重定向之后,Angular SPA不会';t加载svg';s如果下一个http调用失败,选项状态为0 conn REPENDED?奇缘案 正常行为

在OAuth使用散列重定向之后,Angular SPA不会';t加载svg';s如果下一个http调用失败,选项状态为0 conn REPENDED?奇缘案 正常行为,angular,angular-router,angular-oauth2-oidc,Angular,Angular Router,Angular Oauth2 Oidc,用户单击google图标,将reidrect转到google Oauth,成功登录,并将状态详细信息重定向回Angular SPA。SPA处理状态中的散列,并使用访问令牌向我们自己的REST端点发出HTTP请求以进行身份验证 触发 如果我们的REST应用程序关闭,则带有访问令牌的请求将使选项的请求失败,状态为0:连接被拒绝,然后抛出HTTP错误状态0。该错误由catchError块处理,并通知用户。问题已经解决了 错误 现在奇怪的是,当上述场景发生在google的OAuth页面重定向时,我在整个

用户单击google图标,将reidrect转到google Oauth,成功登录,并将状态详细信息重定向回Angular SPA。SPA处理状态中的散列,并使用访问令牌向我们自己的REST端点发出HTTP请求以进行身份验证

触发 如果我们的REST应用程序关闭,则带有访问令牌的请求将使
选项的
请求失败,状态为
0:连接被拒绝
,然后抛出
HTTP错误状态0
。该错误由catchError块处理,并通知用户。问题已经解决了

错误 现在奇怪的是,当上述场景发生在google的OAuth页面重定向时,我在整个应用程序中使用的SVG图标变为空白。按钮仍然可以工作并显示在那里,[img]标记也可以工作,严格来说就是svg图标

现在,我的Oauth登录microsoft是通过弹出窗口而不是重定向来处理的,当相同的场景失败时,svg定义就可以了

SVG 我有一个可重用组件,如下所示:

图标。ts

  location: string;

  constructor(
    @Optional() @Inject(REQUEST) private request: any,
    @Inject(PLATFORM_ID) private platformId: object
  ) {
    if (isPlatformServer(this.platformId)) {
      this.location = this.request.get('host');
    } else {
      this.location = window.location.href;
    }
  }

  @Input() name: string;
  @Input() size: string;
icon.html

<svg
  version="1.1"
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  [style.width]="size"
  [style.height]="size"
>
  <use
    [style.fill]="color ? color : 'white'"
    [attr.xlink:href]="location + '#' + name"
  ></use>
</svg>

现在我最好的猜测是,由于散列,URL在
icon.ts
中的获取方式与此有关,但从我修补它的过程中,我没有成功地使其工作。

我现在正在拆分绝对URL,以便在散列开始后删除所有内容:

  location: string;

  constructor(
    @Optional() @Inject(REQUEST) private request: any,
    @Inject(PLATFORM_ID) private platformId: object
  ) {
    if (isPlatformServer(this.platformId)) {
      this.location = this.request.get('host').split('#')[0];
    } else {
      this.location = window.location.href.split('#')[0];
    }
  }

我现在正在拆分绝对URL,以便在散列启动后删除所有内容:

  location: string;

  constructor(
    @Optional() @Inject(REQUEST) private request: any,
    @Inject(PLATFORM_ID) private platformId: object
  ) {
    if (isPlatformServer(this.platformId)) {
      this.location = this.request.get('host').split('#')[0];
    } else {
      this.location = window.location.href.split('#')[0];
    }
  }

我会在这里放置一些断点:
if(isPlatformServer(this.platformId)){this.location=this.request.get('host');
(isPlatformServer
this.request.get
)和dig。我会在这里放置一些断点:
if(isPlatformServer(this.platformId)){this.location=this.request.get('host');
(包括
isPlatformServer
this.request.get
)并挖掘。