React-native-auth0: auth0.auth.passwordlessWithSMS is not a function

Created on 18 Jun 2020  路  3Comments  路  Source: auth0/react-native-auth0

Attempting to setup auth0 passwordless in my RN app, currently getting the error "auth0.auth.passwordlessWithSMS is not a function". Any advice is appreciated.

Environment
"react": "16.8.3",
"react-native": "0.59.10",
"react-native-auth0": "1.6.0"

Code
import Auth0 from 'react-native-auth0';

const auth0 = new Auth0({
domain: 'MY_DOMAIN', (placeholder for security)
clientId: 'MY_ID', (placeholder for security)
});

getLoginCode() {
this.setState({LogginIn: true});
auth0.auth
.passwordlessWithSMS({
phoneNumber: this.state.phone,
})
.then(() => {
this.setState({codeRequestSent: true});
})
.catch(console.error);
}

onChangeText={text => this.setState({phone: text})}
value={this.state.phone}
/>

onPress={() => this.getLoginCode()}

All 3 comments

Hi @wincod75, I just tried passwordlessWithSMS in the sample app and was not able to reproduce the issue. Will close this one, if you have any further information please comment.

I see you are using an old version of this library. Passwordless support was added back in 2.2.0. If you were following the steps on a tutorial we maintain, let us know the URL so we can update it.

For resolving this try bumping the dependency to the latest version and if you need a solid reference, check the sample app Rita provided above.

@lbalmaceda You nailed it, upgraded to 2.2.0 and it's working like charm, thank you!

Was this page helpful?
0 / 5 - 0 ratings