Issues with Cordova SDK 2.0

book

Article ID: 145600

calendar_today

Updated On:

Products

CA Mobile API Gateway CA Rapid App Security

Issue/Introduction

For a mobile application, the customer's developers experience some issues with Cordova SDK 2.0, on Android and iOS.

Mobile app is using SDK in order to register device/login.

Although standard API calls are working through SDK, they can't seem to be able to handle attachments, whether download or upload, as it gives an error with multi-part boundaries which are not found.

As an interim process, they want to use plain REST API calls instead of using methods from SDK. Problem is that we need to have access to Oauth2 refresh_token, and it would seem only getAccessToken() function exists. Is there a solution for this ?

 

Environment

Release : 4.2

Component : MOBILE API

Resolution

We have attached sample code just showing how to do a post multi-part request. We have used a plugin to choose files in our sample named "Cordova-plugin-chooser"

For iOS :

iOS only supports base64 data as input. So please convert image to base64 string and send it as fileData parameter
For Android :

It supports path and base64. But right now path has a bug which will eventually be fixed. So please convert image to base64 string and send it as fileData parameter


For Download :

SDK Does not support binary data/file to be downloaded. Please use JSON and have the base64 string of image as one of the values in JSON and try to hit the APIs

Attachments

1582288415643__Sample-Code (1).html get_app