-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Unable to make HTTPS POST with client certificate #62
Comments
Hi, the -3 looks like a timeout coming from the ArduinoHttpClient. Also, it looks due to the ssl handshake failing. I have had this before and fixed when using ArduinoHttpClient the call to client.connectionKeepAlive() before startRequest is called. Although technically this shouldn't be necessary. Also, check your ArduinoHttpClient and SSLClient timeout values and play at adjusting them to longer. Maybe go higher and work back. Your post request structure for using the ArduinoHttpClient looks good. With TinyGsm is tend to log out a connection strength operator periodically as well to help diagnose connection issues. |
Hi, I'm also working on with sim800L model modul with sending json request to googleapis.com. But I couldn't build proper structure of POST request. This is my working structure with another library. How can I implement this structure with sslclient.h library
I couldnt use this code with client.post() function. Can anybody help? |
Hi, @ilgarbenli I have used this lib with SIM800L and ArduinoHttpClient successfully A LOT. Just using client.post() method (look at ArduinoHttpClient examples. Using client.write() only And also (my favourite method for completeness, structure and clarity) using a complex and explicit use of ArduinoHttpClient - one of their example shows this. Pretty sure you are better off in this order.
Then do your check for response codes and client availability, etc... and read your responseBody() as a String() (personally yuk!) or as bytes (client.read) into a buffer. The steps above - a good habit is to check return value of any non void function. E.g. client.write returning 0 would mean no bytes were written. Also, good to get familiar with response codes like -2 or -3. Have a look in the ArduinoHttpClient itself, they are defined in there and can refer more often to TLS layer issues caused by poor connection. One of these codes has not come from the server! Hope that helps |
@RobertByrnes thank you for your respond. I tried several things and couldn't make it unfortunately. I guess I'm doing something wrong with my code. I'll open new issue of mine with my full of code. Would you review it when you have a chance |
@cezarg1410 what is resource in client.post(resource); ? |
Resource = "/something" As in https://api.example.com/something You have already given the host when you connected in the connect method as "api.example.com" so now the endpoint or resource is "/something" |
Thank you for your respond and thank you for your help. My code is working now. |
Unfortunately - no luck for me. Looks like, the library or the sim7600 is not able to handle the client certificate - when i remove those two lines:
then it works fine every time (of course i am getting then HTTP 403 response because my server requires proper client certificate). I updated all libraries (TinyGSM, SSLClient and ArduinoHttpClient) to the newest versions and something has changed. Now i am getting -3 error every single time : D I am starting to loose hope :) Looks like i should resign from authenticating client with its certificate, but obviously i would rather not to do it - it is in my opinion the best and the most secure method for exposing API to the internet. |
@cezarg1410 may it works for your case? https://github.com/Samorange1/Connect-ESP32-to-Firebase-via-GSM |
Thanks for that! Looks interesting, will get deep dive into it |
please keep contact together, It worked for me. But also I'm struggling about 403 forbidden issue for another client. Maybe we can help together |
any updates? |
No luck for me. |
solved by v1.2.0 |
Hello,
I have really strange issue when trying to make HTTP POST with SSL from ESP32 with SIM7600G.
The thing is it works from time to time. Probably 1-2 out of 10 calls are successfull. For the rest the library returns -2 or -3 status code.
I can also add, that using that code without SSL auth works perfectly. Also using WiFiClientSecure works really fine.
Here is my full code:
Ane the result:
The text was updated successfully, but these errors were encountered: