Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8623

How to implement OData based BASIC Authentication using HTML, JavaScript for Mobile Apps using Apache Cordova/PhoneGap and datajs-1.1.1.js library

$
0
0

Hello,

 

I am currently developing an App using HTML, JavaScript, SAP UI5 framework and Apache Cordova/PhoneGap, with OData NetWeaver Gateway service.

 

I am facing issues with BASIC Authentication. I have written the code to handle both Valid and Invalid credentials. The code for invalid login scenario work in a way on browser, but not in the iOS App created using Apache Cordova/PhoneGap.

 

Before going on to the App issue on the mobile device, let me explain how it is executing on the browser, so that you may have a clear picture of the issue I am going through.

 

While executing or testing the App's code in browser, if I enter invalid login credentials and tap on the Login button, the OData Service related code is fired and as the credentials are invalid, the browser displays an SAP Login prompt as shown in below Screen shot # 1.

 

Screen Shot # 2 Default SAP Login prompt displayed for wrong credentials in Browser.png

 

When I tap on the Cancel button, in the login prompt, that is when the login failure related code written by me, to display Login Error message is displayed, as shown in below Screen Shot # 2.

 

Error message screen shot.png

 

As I have to develop an iOS Mobile App, I am using Apache Cordova/PhoneGap and placing my HTML , JavaScript code into the PhoneGap project and building the app.

 

When I test my App by entering invalid credentials and tap on the Login button, nothing happens. The App appears to be in a sort of stand-still. Logically the app has to display the login error message, as shown in above Screen shot # 2, but it doesn't do so.

 

Moreover, after waiting for about 30 to 40 seconds and may be even more, when I erase the invalid credentials, enter valid credentials and tap on the Login button, the app continues with the logic written for valid credentials.

 

I am not able to understand why the app behaves this way on the mobile device i.e. the iPad here in this case. Later on, we will be creating an Android version of the same app, using the same code and Cordova/PhoneGap.

 

For OData calls, I have used the standard datajs-1.1.1.js library and Base64.js library to encrypt the credentials for security.

 

It would be of great help, if you could guide me in resolving the issue or provide any reference, which might at least give a lead towards the solution.

 

 

FYI :

The overall setup is simple, from the Mobile Device, the App will directly connect to the SAP Backend, over the internet, through OData service written in ABAP.

 

Awaiting for your valuable inputs.

 

Thanks and Regards,

Suraj Kumar Midgay


Viewing all articles
Browse latest Browse all 8623

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>