ionic framework / ionic native http: ssl client based authentification - ssl

im refering to this issue: https://forum.ionicframework.com/t/ionic-native-http-ssl-client-based-authentification/129596
any ideas how to implement ssl client based authentification (mutual tls) within the ionic framework? im using the ionic native http plugin. i placed the .cer file within the platforms/android/asset folder.
this.http.acceptAllCerts(true);
this.http.enableSSLPinning(false);
this.http.get('https://someip/backend/all', {}, {})
.then(data => {
console.log("data",data)
})
.catch(error => {
console.log("error",error);
});
currently the http requests are not sending the required ssl certificate with each request.
<html>
<head><title>400 No required SSL certificate was sent</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>No required SSL certificate was sent</center>
<hr><center>nginx/1.10.3 (Ubuntu)</center>
</body>
</html>
same issue when using angular/http to send the http requests
ionic info
cli packages: (C:\Users\myname\AppData\Roaming\npm\node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : not installed
local packages:
#ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.3.0 browser 5.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v6.11.3
npm : 3.10.10
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Users\myname\Android\sdk
Misc:
backend : pro

For Android, I use Cordova with the plugin "cordova-client-cert-authentication" installed, this worked straight away: After installing the plugin and compiling the app, it asks for which certificate to use as soon as the app is started and the requests work as expected.
This does require you to install the certificate in your phone's identity storage though, which forces you to enable a lock-screen on your device.

Related

Sockets not working in release build React Native

I'm working on a project where I require sockets. So I implemented a socket connection and was working on debug but not in release build.
I need to get sockets working on release build without using socket.io.
I'm using React Native : 0.61.5
And internet permission is mentioned in manifest file.
Please help.
As mentioned on Github: https://github.com/facebook/react-native/issues/24361
Make sure your config.urlServer is not an HTTP endpoint but should be HTTPS. Latest RN versions target recent Android SDK that blocks insecure HTTP connections automatically
If anyone is facing the same issue, because of the "http" just add android:usesCleartextTraffic="true" in tag in android\app\src\main\AndroidManifest.xml
and you should be good.

Where to find swagger.json for Contenta CMS

Hello I have installed Contenta CMS from here: https://github.com/contentacms/contenta_jsonapi along with the contentajs package from here: https://github.com/contentacms/contentajs I would like to access the api through swagger. I have used npm install http-server and downloaded swagger which shows me the default petstore app at http://localhost:8080. How do I change the swagger output to the Contenta app? The contenta cms is installed in http://mycontenta.com on my local machine

OpenShift application for web app with minified static files (npm run build)

I'm currently developing a web application composed of:
api: an API built with Flask in Python
app: a web app built with vue-cli (based on webpack), and minified with npm run build
I've successfully built the api with an OpenShift Python S2I (source-to-image) image: python-36-rhel7.
I'd like to be able to automatically build the static web app from source and serve it through Nginx or Apache, in a separate app from the same project.
It should:
download the app source from the git repo (context-dir=/app/)
install npm
build it with npm install and npm run build
serve the built html+js+css files
There exist a node.js S2I image but it seems to be more suited for Express.js apps.
What would be the best way to build and serve a minified static web app on OpenShift?

Unable to setup socket1.6.0 for ios version of objective C

I am using Socket.io v1.6.0 for my server side .able to make it configure for my website.
However, when we try to access it from iOS App (objective c) with server URL, I am receiving following error.
We are able to connect to demo servers ws://sandbox.kaazing.net/echo and wss://echo.websocket.org through App .
I am using socket.io-objc library for iOS.
Error :
Domain=SRWebSocketErrorDomain Code=2132 "received bad response code from server 502" UserInfo={NSLocalizedDescription=received bad response code from server 502, HTTPResponseStatusCode=502}
We have tried using the socket-client-swift library in our App. But It seems that it is written in 3.0.1 Swift. My Xcode supports only 3.0.0 so I am unable to integrate it in our App.
You can use SocketIOSwift as an older version using pods
pod 'Socket.IO-Client-Swift'

Unable to connect to MobileFirst Server 8 beta

I am working on ionic with mobilefirst project. While i am trying to integrate ionic App with mobile first, the mobilefirst server is not connecting with my App, in the server console i am not getting any information regarding to my App.
Configuration:
mobilefirst: 8.0.0
cordova: 6.1.1
android: 5.1.1
To first step in order to have the MobileFirst Server recognize your application is to register the application. You can do this in two ways:
Using the MobileFirst CLI
Make sure you have the CLI installed
navigate to the root folder of the application project
Run the command: mfpdev app register
Directly from the MobileFirst Console.
This step will require you to manually enter the details of your application
Load the console, typically localhost:9080/mfpconsole (if running the server locally)
Next to "Applications" in the sidebar navigation click on "New"
Provide the app details:
Name
Platform
bundle ID and version (you can find these in the config.xml file of your application project
The next step is to actually have the application send a request to the server to see if the connection succeeded...
Add the SDK by running the command: cordova plugin add cordova-plugin-mfp
Open the index.js file of your application and add the following code (just an example):
function wlCommonInit() {
WLAuthorizationManager.obtainAccessToken().then(
function () {
alert ("successfully obtained a token from the server");
},
function(response) {
alert("Unable to obtain a token from the server: " + JSON.stringify(response));
}
);
}
Take a look at this Ionic example: https://github.com/csantanapr/mfp8-ionic-demo/blob/master/www/js/app.js
Once the custom "MFP init" has been fired, you can then use the above WLAuthorizationManager API.
If it fails, then you did not properly register your application.
Make sure the version is correct
Make sure the bundle name is correct
Please read through the tutorials: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/all-tutorials/
You can also find Ioic app examples with MFP, here: https://mobilefirstplatform.ibmcloud.com/labs/developers/8.0/intro/