I am currently using react-native-auth0 version 3.0.0, and migrated to 3.0 and while IOS works just fine, android fails to complete the authorization process and provide an accessToken. However when I close the browser after entering the password when logging in using an android device/emulator, the authorization process is successful and proceeds with the returning of accessToken…
Shown below is my build.gradle with specific productFlavors
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
namespace "com.gigreactcli"
defaultConfig {
applicationId "com.gigreactcli"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 32
versionName "2.4.0"
resValue "string", "build_config_package","com.gigreactcli"
}
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
flavorDimensions 'env'
productFlavors {
development {
dimension 'env'
applicationIdSuffix ".development"
manifestPlaceholders = [auth0Domain: "gignology-staging.us.auth0.com", auth0Scheme: "${applicationId}.development.auth0"]
}
staging {
dimension 'env'
applicationIdSuffix ".staging"
manifestPlaceholders = [auth0Domain: "gignology-staging.us.auth0.com", auth0Scheme: "${applicationId}.staging.auth0"]
}
production {
dimension 'env'
applicationIdSuffix ""
manifestPlaceholders = [auth0Domain: "dev-m3kmliv9.us.auth0.com", auth0Scheme: "${applicationId}.auth0"]
}
}
Login.js
try {
await authorize({additionalParameters: {'x-platform': Platform.OS}});
const {accessToken} = await getCredentials();
console.log('accessToken: ', accessToken);
const loginRes = await getAuth0UserInfo(accessToken);
if (loginRes) {
navigation.dispatch(
CommonActions.reset({
index: 0,
routes: [
{
name: 'MainMenu',
},
],
}),
);
setGmailLoading(false);
}
} catch (error) {
console.log(error);
Toast.show({
type: 'error',
text1: 'Login Failed',
text2: 'Something went wrong while logging in. Please try again later.',
});
setGmailLoading(false);
}
};