React-Native-Auth0 package passwordRealm - AuthError: Unauthorized

Hi,

I’m using the official react-native-auth0 package with the environment of

“react-native”: “0.57.0”,
“react-native-auth0”: “^1.3.0”,

I am having issue of using passwordRealm and receiving an alert of AuthError: Unauthorized :

I am able to create users with the following code:

register = (values) => {
console.log(values)
Auth0Instance.auth.createUser({
username: values.email,
email: values.email,
password: values.password,
connection: ‘Username-Password-Authentication’,
metadata: {firstName: values.firstname, middleName:values.middlename, lastName:values.lastname, DOB:values.dob, gender:values.gender}
}).then(console.log)
.catch(console.error)
}

but my login code just returns the above error.

onSubmitForm = (values) => {
console.log(values)
const res = Auth0Instance.auth.passwordRealm({
username: values.email,
password: values.password,
realm: ‘Username-Password-Authentication’,
scope: ‘openid profile email’,
audience: ‘https://’ + Auth0Domain + ‘/userinfo’
}).then(credentials =>
console.log(credentials)
// Successfully authenticated
// Store the accessToken
).catch(error => console.log(error));
}

1 Like

my client id was directed to my machine app - :(.

Hey there!

Sorry for such delay in response! We’re doing our best in providing the best developer support experience out there, but sometimes the number of incoming questions is just too big for our bandwidth. Sorry for such inconvenience!

Do you still require further assistance from us?