react-native-auth0: Could not invoke A0Auth.showUrl
I followed the quick start for react-native.
Now I’m trying to show the login page with
auth0.webAuth .authorize({ scope: 'openid email', audience: 'https://ramtin.auth0.com/userinfo' }) .then(credentials => console.log(credentials)) .catch(error => console.log(error));
But I’m getting “Could not invoke A0Auth.showUrl” error
“react-native”: “0.44.0”, “react-native-auth0”: “^1.0.3”,
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 35 (10 by maintainers)
Commits related to this issue
- Change customtabs version to fix #67 This change fixes an issue several adopters are running into: "Could not invoke A0Auth.showUrl". See: https://github.com/auth0/react-native-auth0/issues/67#issue... — committed to lukewlms/react-native-auth0 by deleted user 7 years ago
- Change customtabs version to the same as default build tools (#78) This change fixes an issue several adopters are running into: "Could not invoke A0Auth.showUrl". See: https://github.com/auth0/reac... — committed to auth0/react-native-auth0 by deleted user 7 years ago
I ran into this issue previously and concluded that it was due to the fact that
launchUrl
wasn’t added until Android SDK 25 so I assumed that I would need customtabs support library 25 or newer.To get around this without tweaking files in node_modules I updated the build.gradle in the root of my project to use the customtabs support library 25.0.1 whenever customtabs support library < 25 is being used
I did this by adding the following to my build.gradle file
Hi
I also have this issue, and almost same as @ronitslyper 's method, I change build.gradle file, but instead of changing every linked-in libraries, I only change node_modules/react-native-auth0/android/build.gradle
from
change to
and that’s it, I open webauth page successfully, although I don’t know why ~ lol
I’ve the same problem too.
The error message is a little misleading in fact because the code where it crashes is this one:
So we could think that the problem is in the second to last line
getReactApplicationContext().startActivity(intent);
since the error message is talking about a missing startActivity method. But it’s not.In reality, if we invert the if condition, it kind of fixes the bug. Try replacing the lines above with:
and the bug is gone.
I’ve found a stack overflow question that matches this same bugs here
It suggests to bump the support SDK versions to 25.1.0
But as soon as you do this, you got a new error which this time leads to the real function which is launchUrl.
As referred here, this method is available only since API 25.0.0 so it could explain the problem (or not).
Several SDK had this last bug too (Firebase, Spotify and others)
After several tests, I didn’t find a way to fix this other than the one above which skip the CustomTabsIntent all together
Anyway, hope these information help solving this issue!