If you are encountering 401 Unauthorized errors when your OutSystems application tries to register an iOS device with Pushwoosh, it is typically because the Device API Token is not being set correctly. This is a required step for secure communication with the Pushwoosh API.
Follow these steps to resolve the issue:
Update the Plugin: Ensure you are using the latest version of the Pushwoosh plugin from the OutSystems Forge. Older versions may have issues with API token handling on iOS.
Use the
setApiTokenAction: The correct way to provide the API token is by using thesetApiTokenclient action. This action must be called before theRegisterDeviceaction.Implement the Logic: In your application's logic flow (for example, in an
OnApplicationReadyevent), structure your actions in the following order:- Call the
setApiTokenaction. Pass your Device API Token as the input parameter. You can find this token in your Pushwoosh Control Panel under your application's API Access section. - Immediately after, call the
RegisterDeviceaction to register the device for push notifications.
- Call the
Verify Credentials: Double-check that you are using the correct Pushwoosh Application Code in the plugin's required parameters and the correct Device API Token for the specific application you are working with (e.g., development vs. production).
Example Logic Flow:
OnApplicationReady Event:
-> setApiToken(ApiToken: "YOUR_DEVICE_API_TOKEN")
-> RegisterDevice()
By following this sequence, the SDK will be properly authenticated before attempting to register the device, which will resolve the 401 Unauthorized error. Using Extensibility Configurations to set the API token is not the correct method for recent plugin versions.
Comments
0 comments
Please sign in to leave a comment.