SSL Error when requesting to https backend

Hi,

I have a backend something like this: https://exmple.net/login. When I send request from my ionic 2 app to backend via ios device or simulator , I am getting following error:

Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made.

Do I have to embed SSL certificate inside of ionic app or do I have to do something else?

Thanx in advance

Nobody has the same problem?

Obviously not in the last 28 minutes you took before bumping your topic.

Show us the code used to request that URL in your Ionic app.
You can do the same request in e.g. Postman? (or browser if it is just a GET request?)

Thanks for reply!

It is just GET request with

.requestOptions.withCredentials = true;

After I set Allow-Control-Origin:*, it is working in POSTMAN and browser. But I know it is not a safe way.
I have already had ssl certificate from backend but I donā€™t know what should I do with it right now.

What does [quote=ā€œMeliha, post:4, topic:90042ā€]
.requestOptions.withCredentials = true;
[/quote]

or [quote=ā€œMeliha, post:4, topic:90042ā€]
After I set Allow-Control-Origin:*, it is working
[/quote]

have to do with an SSL Error?

Is it a proper certificate or did you have to do things in Chrome to accept it?

Also: You didnā€™t post any code of how you do the request.

I have a proper certificate.
My request to backend:

let requestOptions = new RequestOptions({
url: https://exmple.net/login
});

this.http.get(new Request(requestOptions));

And after executing this request I am getting following error on IOS device or simulator

Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made.

And after executing same request on web I am getting following error:

XMLHttpRequest cannot load https://exmple.net/login. It has been blocked by CORS policy: No ā€˜Access-Control-Allow-Originā€™ header is present on the requested resource. Origin ā€˜http://localhost:8100ā€™ is therefore not allowed access.

That is my exact problem

Google for the error message, first result:

And here the Cordova plugin so solve this:

Why are you posting here if you didnā€™t even google the error message?

Two very different, totally unrelated problems.

How do you know I did not google it?
I asked here to find an answer not rude attack!!!

1 Like

So did you google the error or didnā€™t you?
Result #1 was the perfect explanation for why the error is happening.