Skip to main content
Version: 6.x

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@6
_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 variables.gradle file located at android/variables.gradle by adding the following variables:


_10
ext {
_10
...
_10
AUTH_URL_SCHEME = 'mycustomscheme' /// CHANGE THIS TO YOUR CUSTOM AUTH SCHEME
_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.

Android Configuration

When using App Links on Android, Auth Connect will automatically handle configuring the Intent Filter on the Activity, so you can skip the Intent Filter Step on the guide.

However, it is essential to set the AUTH_URL_HOST and the AUTH_URL_PATH_PREFIX to ensure that your app handles authentication callbacks correctly.

Add this configuration directly to your project's variables.gradle file located at android/variables.gradle:


_10
ext {
_10
...
_10
AUTH_URL_HOST = 'example.com' /// Replace 'example.com' with your actual host
_10
AUTH_URL_PATH_PREFIX = '/login' /// Replace '/login' with your actual path prefix
_10
}

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.