Hi, I am currently doing a POC on Android using react-native-app-auth.
I am able to successfully invoke authorize method and open the web browser.
However, on successful login (after putting username & password on the browser), I am not redirected to the app.
Below are my setup.
App.js
const config = {
issuer: 'https://some.domain.net',
clientId: ${CLIENT_ID},
redirectUrl: 'com.myapp.reactnative:/oauthredirect',
scopes: ['openid','profile','offline_access'],
additionalParameters: {
nonce: ${NUMBERS}
}
};
AndroidManifest.xml
`
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
`
/android/app/build.gradle
defaultConfig {
...
manifestPlaceholders = [
appAuthRedirectScheme: 'com.myapp.reactnative'
]
}
I also made some changes on RNAppAuthModule class as follows :
`
private void authorizeWithConfiguration(
final AuthorizationServiceConfiguration serviceConfiguration,
final AppAuthConfiguration appAuthConfiguration,
final String clientId,
final ReadableArray scopes,
final String redirectUrl,
final Map
) {
...
if (additionalParametersMap != null) {
...
authRequestBuilder.setResponseType("code id_token");
authRequestBuilder.setState(MY_STATE);
authRequestBuilder.setResponseMode("form_post");
authRequestBuilder.setAdditionalParameters(additionalParametersMap);
}
AuthorizationRequest authRequest = authRequestBuilder.build();
...
}
`
Please let me know if I need to add more details.
Thanks.
_Originally posted by @fahmi-f7 in https://github.com/FormidableLabs/react-native-app-auth/issues/162#issuecomment-448428563_
Hi @fahmi-f7 - are you still working on this? If so, what identity provider are you using?
Hi, I'm experiencing the same issue. I'm using Google authorization provider.
After successful authentication by Google the browser window stays open with my google account signed in at the google's search engine landing page.
I've tried to debug the Java code (though I'm not an Android developer) and found out that RNAppAuthModule.onActivityResult method is not fired until I close the browser window and then it receives User canceled flow error.
However I'm not sure if I'm signing my app correctly. Since at google cloud console when creating clientID for Android it asks for additional Signing-certificate fingerprint while for clientID for iOS nothing regarding signing the app is required. Do you think this might be the issue ?
EDIT: After deeper investigation, I've found that my gradle config was wrong. I've set the setting appAuthRedirectScheme to com.example.app and not the identity server scheme com.googleusercontent.apps.CLIENT_ID Now everything is working OK.
Most helpful comment
Hi, I'm experiencing the same issue. I'm using Google authorization provider.
After successful authentication by Google the browser window stays open with my google account signed in at the google's search engine landing page.
I've tried to debug the Java code (though I'm not an Android developer) and found out that
RNAppAuthModule.onActivityResultmethod is not fired until I close the browser window and then it receivesUser canceled flowerror.However I'm not sure if I'm signing my app correctly. Since at google cloud console when creating clientID for Android it asks for additional Signing-certificate fingerprint while for clientID for iOS nothing regarding signing the app is required. Do you think this might be the issue ?
EDIT: After deeper investigation, I've found that my gradle config was wrong. I've set the setting
appAuthRedirectSchemetocom.example.appand not the identity server schemecom.googleusercontent.apps.CLIENT_IDNow everything is working OK.