Expo is now the official recommendation according to React Native's documentation
In order to make Authgear work with Expo's Android build, currently we need to implement a custom plugin:
// src/plugins/authgear-plugin.ts
import { ConfigPlugin, withAndroidManifest } from "expo/config-plugins";
const withAuthgearOAuth: ConfigPlugin = (config) => {
return withAndroidManifest(config, (config) => {
const mainApplication = config.modResults.manifest.application?.[0];
if (mainApplication == null) {
return config;
}
mainApplication.activity ??= [];
mainApplication.activity.push({
$: {
"android:name": "com.authgear.reactnative.OAuthRedirectActivity",
"android:exported": "true",
"android:launchMode": "singleTask",
},
"intent-filter": [
{
action: [
{
$: {
"android:name": "android.intent.action.VIEW",
},
},
],
category: [
{
$: {
"android:name": "android.intent.category.DEFAULT",
},
},
{
$: {
"android:name": "android.intent.category.BROWSABLE",
},
},
],
data: [
{
$: {
"android:scheme": config.android?.package,
"android:host": "authgear",
"android:pathPrefix": "/proceed",
},
},
],
},
],
});
return config;
});
};
export default withAuthgearOAuth;
And include in app.config.ts
export default ({ config }: ConfigContext): ExpoConfig => {
return {
// ...other configs
plugins: [
// ... other plugins
"./src/plugins/authgear-oauth-plugin.ts",
],
};
};
Wonder if it can be included as official plugin for easier integration? Then it can be installed with expo install
Note that manifest merging is also possible (https://docs.expo.dev/config-plugins/development-and-debugging/#modify-androidmanifestxml) but I didn't experiment with it.
Expo is now the official recommendation according to React Native's documentation
In order to make Authgear work with Expo's Android build, currently we need to implement a custom plugin:
And include in
app.config.tsWonder if it can be included as official plugin for easier integration? Then it can be installed with expo install
Note that manifest merging is also possible (https://docs.expo.dev/config-plugins/development-and-debugging/#modify-androidmanifestxml) but I didn't experiment with it.