【发布时间】:2019-09-11 17:23:10
【问题描述】:
问题是如何从响应对象中获取我用来登录的用户名?
我正在通过以下代码创建 Auth0Lock 实例:
this._lock = new Auth0Lock(AUTH_CONFIG.clientId, AUTH_CONFIG.domain, AUTH_CONFIG.options);
然后我订阅“已验证”事件:
this._lock.on('authenticated', authResult => {
this._lock.getUserInfo(authResult.accessToken, function(error, profile) {
console.log('profile', profile); // --> undefined
if (error) {
// Handle error
}
});
})
我正在使用以下凭据登录:
用户名:john@gmail.com 密码:123456
我希望能够在 authResult 对象的某处看到“用户名:john@gmail.com”。 但很遗憾我没有看到。
我应该在 Auth0lock 选项中添加一些东西吗?
附:我在“已验证”事件的处理程序中添加了以下代码,但它返回未定义的配置文件。
【问题讨论】:
-
查看文档的第 2 步:auth0.com/docs/libraries/lock/v11
-
当我调用 this.getUserInfo(authResult.accessToken, function(error, profile){ console.log('profile', profile) }) 我收到错误:Uncaught TypeError: _this2 .getUserInfo 不是函数
标签: javascript angularjs reactjs authentication auth0