所以我的代码如下所示。但是由于某种原因,我不断收到下面的错误。我在auth0中为本机应用程序打开了密码授予类型,并且我知道我的网址路径是正确的,因为我能够使用相同的程序包在auth0上创建用户。有人知道问题出在哪里吗?
AuthError:未经授权
onSubmitForm = (values) => {
console.log(values)
const res = Auth0Instance.auth.passwordRealm({
username: values.email,
password: values.password,
audience: 'https://' + Auth0Domain + '/userinfo',
realm: 'Username-Password-Authentication',
scope: 'openid profile email'
}).then(credentials =>
console.log(credentials)
// Successfully authenticated
// Store the accessToken
).catch(error => console.log(error));
}
注册码在下面
register = (values) => {
console.log(values)
Auth0Instance.auth.createUser({
username: values.email,
email: values.email,
password: values.password,
connection: 'Username-Password-Authentication',
user_metadata: { firstName: values.firstName, middleName: values.middleName, lastName: values.lastName }
}).then(console.log)
.catch(console.error)
// NavigationService.navigate('Main')
}