Before integrating Auth Connect into your Ionic app, you’ll need to get Okta up and running.
For complete information on configuring Okta, consult the official documentation which includes tutorials on creating users and applications.
We recommend following the guide for Single Page Applications. This will enable your application to use the PKCE authentication flow and will work for both browser and app authentication.
Run the following command to install the Auth Connect plugin. For the
AUTH_URL_SCHEME variable, use the globally unique App Id (ex:
com.company.app) you decided on when configuring the Azure AD app above.
If you have not already setup Ionic Enterprise in your app, follow the one-time setup steps.
Next, install the plugin:
It's recommended to create an
AuthenticationService class that encapsulates Okta and Ionic Auth Connect’s login functionality.
Generate this class using the
ionic generate command:
IonicAuth class, then configure all Okta details in the
Some of these
IonicAuthOptions values are unique, and must be set based on your Okta details:
platform: Use “cordova” or “capacitor” accordingly.
clientID: Your app’s Client ID, found under Applications -> [Your Application] -> General.
redirectUri: The URI to redirect to after the user has logged in. Use the same AUTH_URL_SCHEME variable value (App Id) from when the Auth Connect plugin was installed. Example: com.company.app://callback. Find this under Applications -> [Your Application] -> General.
logoutUrl: The URI to redirect to after the user has logged out. Example: com.company.app://login?logout=true. Find this under Applications -> [Your Application] -> General.
discoveryUrl formula is:
ORGANIZATION_DOMAIN is the domain you created when setting up your Okta account. You can find a reference to this under Applications -> [Your Application] -> Sign On -> OpenID Connect ID Token -> Issuer