Instructions to upgrade to Cordova plugin version to 4.0

This chapter describes the steps to take in order to migrate from Cordova plugin 3.0 to 4.0.

Mobile authentication

The mobile authentication configuration for the Android platform has changed. We switched from Google Cloud Messaging (GCM) to Firebase Cloud Messaging (FCM). In order to enable push mobile authentication for the Android platform in your project you must perform the steps described in the paragraphs below.

Import your GCM project as a Firebase project

You must make sure that your Google project is imported into FCM:

  1. Go to Firebase Console.
  2. Follow the instructions described in Import your GCM project as a Firebase project section of the GCM to FCM migration guide.

Remove the GCM sender id property

Due to the migration to FCM, the GCM Sender Id property (OneginiGcmSenderId) is no longer used and should be removed from your config.xml.

Follow the setup instructions for FCM

In addition to importing your project into the FCM console you must also configure FCM in your Cordova project. See the push mobile authentication topic guide for further instructions.

User authentication

onegini.user.authenticate behaviour has changed

This function no longer returns an error when the user profile that is passed is already authenticated. Instead, the user is logged out and has to authenticate again. If you are using this function in the assumption that it will check if the user is already authenticated, you may explicitly check this using onegini.user.getAuthenticatedUserProfile.

onegini.user.reauthenticate has been removed

Because of the changes in onegini.user.authenticate, the reauthenticate function is now redundant as it would provide the same behaviour as the authenticate function. It is therefore removed and you may instead use ongegini.user.authenticate.

Fetching resources

The default Content-Type value has changed for iOS

For iOS we were setting the default value for the Content-Type header to application/json in case it was not specified. For Android we were specifying text/plain as the default Content-Type header value. From this version on both iOS and Android specify the text/plain as the default Content-Type header value.

Fetching anonymous resources

We deprecated the anonymous attribute of the onegini.resource.fetch method in favour of the auth property. See the fetch method reference documentation for details.