【问题标题】:Auth0 Angular parseHash returns undefinedAuth0 Angular parseHash 返回未定义
【发布时间】:2018-07-21 04:07:52
【问题描述】:

我正在使用 auth0-jwt 来处理身份验证:

this.auth0.parseHash((err, authResult) => {
  if (authResult && authResult.accessToken && authResult.idToken) {
    window.location.hash = '';
    this.setSession(authResult);
    this.router.navigate(['/']);
  } else if (err) {
    this.router.navigate(['/']);
  }
});

但是,虽然 window.location.hash 包含 authResult: #access_token=qwe&expires_in=7200&token_type=Bearer&state=zbc&id_token=xyz, auth0.parseHash 返回无效令牌,authResult 未定义 我在用 : "@auth0/angular-jwt": "^1.0.0-beta.9", "auth0-js": "^9.2.2"

【问题讨论】:

  • 嗨 Yuvals - 你解决了这个问题吗?我不断收到 invalid_token 错误:{error: "invalid_token", errorDescription: "Issuer DOMAIN is not valid."}
  • @JackVaughan 如果您使用 Facebook 等社交登录,请确保您使用自己的应用程序凭据,而不是 Auth0 示例中的凭据。我相信这是我的问题。
  • 如果不是,请确保您在 auth0 和您的应用程序上都定义了正确的域
  • 感谢@Yuvals 的回复 - 原来我的域错了。

标签: angular jwt auth0 angular2-jwt


【解决方案1】:

问题在于应用程序和 Auth0 上定义的域都使用了错误的域

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-10-26
    • 2020-09-24
    • 2018-08-27
    • 1970-01-01
    • 2018-10-16
    • 1970-01-01
    • 2017-12-21
    • 2019-10-19
    相关资源
    最近更新 更多