Custom Expo config plugin for react-native-app-auth with full Swift AppDelegate support.
This plugin automatically configures iOS and Android for OAuth authentication when running expo prebuild. It replaces @wavemaker/react-native-app-auth-expo-plugin with full Swift support for modern Expo SDK versions.
Compatible with react-native-app-auth ^8.0.3
- Adds
CFBundleURLTypesto Info.plist for OAuth redirect handling - Modifies
AppDelegate.swiftto implementRNAppAuthAuthorizationFlowManagerprotocol - Adds
authorizationFlowManagerDelegateproperty - Implements
application(_:open:options:)for URL scheme redirects - Implements
application(_:continue:restorationHandler:)for universal links - Creates/modifies bridging header with required Objective-C imports
- Adds
RedirectUriReceiverActivityto AndroidManifest.xml - Adds
manifestPlaceholdersto app/build.gradle
First, install react-native-app-auth if you haven't already:
npm install react-native-app-auth@^8.0.3
# or
yarn add react-native-app-auth@^8.0.3
# or
bun add react-native-app-auth@^8.0.3Then install this plugin from the private git repository:
npm install git+ssh://git@github.com/sona-is/react-native-app-auth-plugin.git
# or
yarn add git+ssh://git@github.com/sona-is/react-native-app-auth-plugin.git
# or
bun add git+ssh://git@github.com/sona-is/react-native-app-auth-plugin.gitAlternatively, add it to your package.json:
{
"dependencies": {
"react-native-app-auth-plugin": "git+ssh://git@github.com/sona-is/react-native-app-auth-plugin.git"
}
}The plugin ships with pre-built JavaScript files, so no compilation is required during installation.
Add the plugin to your Expo config file (app.config.ts or app.config.js):
plugins: [
[
'react-native-app-auth-plugin',
{
redirectScheme: 'your.app.scheme',
},
],
]redirectScheme(string): The URL scheme for OAuth redirects (e.g.,is.sona.staging).
bundleId(string): Bundle identifier for iOS (defaults toconfig.ios.bundleIdentifier).
The plugin ships with pre-built files in the build/ directory. When making changes to the TypeScript source:
npm run build
# or
bunx tsc -p .Important: Commit the updated build/ directory after making changes so users get the latest pre-built version.
Run prebuild to verify the plugin generates correct native code:
npx expo prebuild --cleanVerify the following files were modified:
ios/<ProjectName>/AppDelegate.swift– Protocol conformance and OAuth methodsios/<ProjectName>/<ProjectName>-Bridging-Header.h– Objective-C importsios/<ProjectName>/Info.plist–CFBundleURLTypesandroid/app/src/main/AndroidManifest.xml–RedirectUriReceiverActivityandroid/app/build.gradle–manifestPlaceholders
- Uses
@expo/config-pluginsmods:withInfoPlist,withAppDelegate,withXcodeProject,withAndroidManifest,withAppBuildGradle. - Default export is wrapped with
createRunOncePluginto prevent double application when composed. - All modifications are idempotent to safely run multiple times.
- Ensure install ran the plugin’s
preparescript: re-run your package manager's install command. - As a fallback during development, build manually:
npm run buildorbunx tsc -p ..
Verify the redirect URL in your OAuth configuration matches the scheme:
redirectUrl: 'your.app.scheme://auth/'