Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/411.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
Javascript Auth0登录身份验证_Javascript_Angular_Login_Auth0 - Fatal编程技术网

Javascript Auth0登录身份验证

Javascript Auth0登录身份验证,javascript,angular,login,auth0,Javascript,Angular,Login,Auth0,我在Auth0中注册了一个用户以登录(在仪表板的用户选项中) 我使用以下代码对用户进行身份验证(使用带有用户名和密码的html表单) 它工作得很好。 但是,由于redirect.loginWithCredentials被弃用,我想使用client.login,但它不起作用。这是我的密码 this.auth0.client.login({ realm: 'Database', grant_type: 'http://auth0.com/oauth/grant-type/pa

我在Auth0中注册了一个用户以登录(在仪表板的用户选项中) 我使用以下代码对用户进行身份验证(使用带有用户名和密码的html表单)

它工作得很好。 但是,由于redirect.loginWithCredentials被弃用,我想使用client.login,但它不起作用。这是我的密码

this.auth0.client.login({
      realm: 'Database',
      grant_type: 'http://auth0.com/oauth/grant-type/password-realm',
      username,
      password,
      scope: 'openid profile',
    }, err => {
      if (err) return alert(err.description);
  });
我认为问题在于这个领域的名称。使用我在Auth0中创建的用户的领域名称是什么


谢谢大家

应该设置为连接名称。看

在您的情况下,请尝试设置为
用户名密码身份验证

从文档中:

将新请求参数realm设置为用户所属的领域。 这将映射到Auth0中的连接。例如,如果你有 为内部员工和您配置了数据库连接 将连接命名为employees,然后使用此值


了解您正在使用的auth0.js库的版本很有帮助。您是否尝试将DB连接的名称作为域值,即用户名-密码身份验证(在此处添加注释,而不是答案,因为我没有明确检查)感谢它是v 8.8.0Hi,我下面的答案是否解决了您的问题?Hi,您解决了问题吗?
this.auth0.client.login({
      realm: 'Database',
      grant_type: 'http://auth0.com/oauth/grant-type/password-realm',
      username,
      password,
      scope: 'openid profile',
    }, err => {
      if (err) return alert(err.description);
  });