0

These are my remote server credentials that I want to connect from my local device.

Server  m12.cloudserver.com
User    <myname>
Password    <mypassword>
Port    19999
_ or 
api_key 5678909876-009-00d

I want to use the WiFiClient client() API as shown, but where or how do I include the User credentials ? so that I can make a successful connection to the remote server from my device connected over Wifi.

Cut and paste from my Arduino code.

const int httpPort = 19999;
if (!client.connect("m12.cloudserver.com", httpPort)) {
 Serial.println("connection failed");
 return;
}
  • Read the API docs. – gre_gor May 10 '17 at 13:56
1

WifiClient provides low level tcp connection. Your server seems to be implementing a REST API interface. Thus you need to construct HTTP headers (GET, POST, etc.) manually as a string. Then you can add your credentials. Before doing so, try to use your server, I mean call api's with the program named Postman. Postman runs on Chrome browser. Postman can compose such headers for you. Then you can insert them into your arduino code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.