Skip to main content
Version: 5.0

Installation

Don't have an Auth Connect subscription? Try it free now.

Follow these steps to install Auth Connect into your app.

Setup Ionic Enterprise Key

If you have not already setup Ionic Enterprise in your app follow the one-time setup steps then install the plugin for Capacitor or Cordova:

Capacitor


_10
npm install @ionic-enterprise/auth@5
_10
npx cap sync

Next, you must setup your application with either a Custom URL Scheme (easier) or Deep Linking (more secure).

Custom URL Scheme

You will need to manually update the native project config files.

For Android, update the build.gradle file located at android/app/build.gradle by adding the following code to the android/defaultConfig block:


_10
android {
_10
...
_10
defaultConfig {
_10
...
_10
manifestPlaceholders = [
_10
'AUTH_URL_SCHEME': 'mycustomscheme' /// CHANGE THIS TO YOUR CUSTOM AUTH SCHEME
_10
]
_10
}
_10
}

For iOS, update the file located at ios/App/App/Info.plist by adding the following inside the existing CFBundleURLTypes node:


_10
<dict>
_10
<key>CFBundleURLSchemes</key>
_10
<array>
_10
<string>$AUTH_URL_SCHEME</string>
_10
</array>
_10
</dict>

Stop after this step. The following section on Deep Linking is an alternative to using a custom URL Scheme.

Deep Linking

As anyone can register a URL scheme for their application (including a duplicate of the one you chose) you can avoid this by associating a domain that you own with your application (known as Universal links or App links). This allows you to use a redirectUri with the format https://your-domain-name.

Follow Capacitor's Deep Links guide to enable this feature and do not forget to modify the redirectUri and logoutUrl in your apps configuration as well as adding the url to your auth providers list of allowed redirect URLs.

Cordova


_10
ionic cordova plugin add @capacitor/plugin-cordova-compat
_10
ionic cordova plugin add @ionic-enterprise/auth@4 --variable AUTH_URL_SCHEME='mycustomscheme'

Custom URL Scheme Naming Consideration​

It is recommended to replace $AUTH_URL_SCHEME with your application's bundle id (com.company.myapp), or another value unique from other custom URL schemes (such as myapp://) registered with your app.

This prevents plugins that handle deep linking from intercepting callbacks made by authentication providers that Auth Connect relies on to complete login/logout functionality.