This comes up when I call a react-native-auth0 function from my Expo app
This is the function I call:
onLogin() {
auth0.webAuth
.authorize({
scope: 'openid profile',
audience: 'https://' + credentials.domain + '/userinfo'
})
.then(credentials => {
Alert.alert(
'Success',
'AccessToken: ' + credentials.accessToken,
[{ text: 'OK', onPress: () => console.log('OK Pressed') }],
{ cancelable: false }
);
this.setState({ accessToken: credentials.accessToken });
})
.catch(error => console.log(error));
}
When I run react-native link react-native-auth0 this is what the console says:
C:\Users\schicdevice-mgr>react-native link react-native-auth0
Scanning folders for symlinks in C:\Users\schicdevice-mgr\node_modules (31ms)
It doesn't say anything else.
Version information:
npm 3.10.10
react-native-cli: 2.0.1
react-native: 0.48.4
[email protected]
Would appreciate any help at all
@DanSchick I have not tried with Expo. However, I believe they do not support the standard react-native link. You can read more about it in this issue https://github.com/expo/expo/issues/56
It talks about using ExponentKit to facilitate this.
Be great if you can report back. Thanks
Thanks for your response, it seems obvious in retrospect
I don't think I'm going to use ExpoKit, so I ended up using the built in Expo class featured here:
Thanks, not actually seen that before.
I have the same issue without using Expo. I get this error after running auth0.webauth.
react-native: "0.49.3"
"react-native-auth0": "^1.2.1"
@SamiChab The alternative solution in the Expo is provided in the sample above https://github.com/expo/auth0-example
In Expo if you want to link native modules you need to look into ExponentKit
I still use react native and after using react-native link, everything works fine on IOS, but not on Android. I have been hitting my head to the wall for nearly 1 week for this. After that, I downloaded the login example of React Native of Auth0 again and checked every single file to see the difference and see that I HAVE TO put the new A0Auth0Package(), into the MainApplication.java in order to make it work. This is so tricky !!!! Hopefully this will help someone later
@bubuzzz please can you create a new issue for this and tell me the steps you took/what was missing for you.
Also what version of RN are you using? I'm wondering if anything has changed in RN. Thx
@bubuzzz solution worked for me.
Add new A0Auth0Package() to MainApplication.java in the
@Override
public List<ReactPackage> createAdditionalReactPackages() {
// Add additional packages you require here
return Arrays.<ReactPackage>asList(
new A0Auth0Package(),
.....
);
}
Don't forget to import import com.auth0.react.A0Auth0Package;
Also worth noting that we are NOT using Expo.
I'm trying to implement Auth0 to my React Native app. Everything works fine on iOS but on Android I get the same as this issue. When I try to add A0Auth0Package to my MainApplication.java, I get an error: package com.auth0.react does not exist. How did you guys manage to get this to work for Android?
@cjrorvik did you add:
dependencies { compile project(':react-native-auth0') ...} in your app's build.gradle?
Please share your app's build.gradle.
This problem seems to recur with the current release. @tannerhallman's solution seems to be the forgotten and/or misapplied item.
Still happening in iOS.
I got the following error: "Error. Missing NativeModule. Please make sure you run 'react-native link react-native-auth0".
RN: 0.60.4
react-native-auth0: 1.5.0
The following command resolved this issues for me.
$ cd ios && pod install && cd ..
Most helpful comment
@bubuzzz solution worked for me.
Add
new A0Auth0Package()toMainApplication.javain theDon't forget to import
import com.auth0.react.A0Auth0Package;Also worth noting that we are NOT using Expo.