I created an API in Spring for my react app. When I was ready to publish site I noticed that the app can not call the api. I went to the api link and noticed it said this site is not secure. I did create a self assigned certificate so that https would work but its giving me this issue now. Until I click trust the react app will not fetch the data. Once I click trust once it works but other people using my site wont know that. How can I fix my API so that it is trusted?
1 Answer
The problem is that you're creating an SSL Certificate build by yourself. Browsers only accept trusted certificates signed by companies.
You will need to buy a certificate and use it on your app. Here's a source of signed certificates: https://www.getssl.com/
I did never used the free options, but some people say it works fine too: https://www.sslforfree.com/
For better understanding of that I strongly recommend you the following video: https://www.youtube.com/watch?v=uNdYea6OCuA
Hope it helps you bro.
-
these are for domains it seems, how can I get a certificate for my API link? Commented Jun 9, 2020 at 2:13
-
If your API is running on a server you must provide a domain for it and use one of those trusted certificates. If you're running it on localhost you don't need a certificate ;) Commented Jun 9, 2020 at 3:37
-
how can i get a certificate to run it on my machine so my site can connect to my machine Commented Jun 9, 2020 at 17:29
-
Man, what you really need is to get back to the basics. You're totally misunderstanding the complete idea of web development. First of all your web site wont point to your localhost. In the second place if you want to run the entire app, front and back on your machine then you don't need a certificate, as I already said. In the third place, if you just want to made your site online to do a quick presentation you don't even need a running server, you can use ngrok and it will give you a DNS to connect to your personal computer. Now get back to google and youtube and try to study. Commented Jun 9, 2020 at 17:46
-
I dont think you are understanding my situation. I have a website up and running, its a react app. The backend is all in Java spring boot. My react app that is up and running makes calls to my java spring boot api. My issue is my api is running on my local machine so im using its Ipv4 address. My react app does a fetch to my machine's ip to call the api. However my api has a self assigned certificate so it is not trusted by my browser. I need to get a certficate for my ip address. Commented Jun 9, 2020 at 17:52