Auth0 Home Blog Docs

React-Native-Auth0 package passwordRealm - AuthError: Unauthorized


#1

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));
}


#2

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