Continue errors on http get request

Hi guys, i’m a new user of arduino so i’m not very skilled to use it.
My hardware is:
-Arduino Uno
-Wireless Sd Shield
-Wirelezz module RN-XV 171

I have installed the WiFly library and i have created a mock server with postman with a easly get request that return “ok” massage.

I use a examples skecth from the WiFly library.
The code is:

#include <WiFlyHQ.h>
#include <SoftwareSerial.h>
SoftwareSerial wifiSerial(8,9);

//#include <AltSoftSerial.h>
//AltSoftSerial wifiSerial(8,9);

WiFly wifly;

/* Change these to match your WiFi network */
const char mySSID[] = "******";
const char myPassword[] = "******";

const char site[] = "http://*******";

void terminal();

void setup()
    char buf[32];

    Serial.print("Free memory: ");

    if (!wifly.begin(&wifiSerial, &Serial)) {
        Serial.println("Failed to start wifly");

    /* Join wifi network if not already associated */
    if (!wifly.isAssociated()) {
	/* Setup the WiFly to connect to a wifi network */
	Serial.println("Joining network");

	if (wifly.join()) {
	    Serial.println("Joined wifi network");
	} else {
	    Serial.println("Failed to join wifi network");
    } else {
        Serial.println("Already joined network");


    Serial.print("MAC: ");
    Serial.println(wifly.getMAC(buf, sizeof(buf)));
    Serial.print("IP: ");
    Serial.println(wifly.getIP(buf, sizeof(buf)));
    Serial.print("Netmask: ");
    Serial.println(wifly.getNetmask(buf, sizeof(buf)));
    Serial.print("Gateway: ");
    Serial.println(wifly.getGateway(buf, sizeof(buf)));

    Serial.print("DeviceID: ");
    Serial.println(wifly.getDeviceID(buf, sizeof(buf)));

    if (wifly.isConnected()) {
        Serial.println("Old connection active. Closing");

    if (, 80)) {
        Serial.print("Connected to ");

	/* Send the request */
	wifly.println("GET /test HTTP/1.0 ");
    } else {
        Serial.println("Failed to connect");

void loop()
    if (wifly.available() > 0) {
	char ch =;
	if (ch == '\n') {
	    /* add a carriage return */ 

    if (Serial.available() > 0) {

/* Connect the WiFly serial to the serial monitor. */
void terminal()
    while (1) {
	if (wifly.available() > 0) {

	if (Serial.available() > 0) {

When i run this code with HTTP/1.0 i have this error

16:19:04.509 -> open http://a************************ 80
16:19:04.741 -> Connected to http://******************
16:19:04.907 -> HTTP/1.1 401 Unauthorized
16:19:04.940 -> 
Access-Control-Allow-Origin: *
16:19:04.974 -> 
Content-Type: application/json; charset=utf-8
16:19:05.040 -> 
Date: Tue, 17 Sep 2019 14:19:05 GMT
16:19:05.073 -> 
ETag: W/"63-NBrQ********************mc"
16:19:05.107 -> 
Server: nginx
16:19:05.140 -> 
Vary: Accept-Encoding
16:19:05.174 -> 
x-srv-span: v=1;s=f1********23b
16:19:05.208 -> 
x-srv-trace: v=1;t=2af********6
16:19:05.242 -> 
Content-Length: 99
16:19:05.275 -> 
Connection: Close
16:19:05.275 -> 

16:19:05.275 -> 
{"error":{"name":"invalidCredentialsError","message":"Unable to authenticate using access token."}}

Instead if i set HTTP/1.1 i have this other error

18:15:59.170 -> DeviceID: Wifly-WebClient
18:16:00.307 -> open http://a******************************* 80
18:16:00.507 -> Connected to http://a**************************
18:16:00.673 -> HTTP/1.1 400 BAD_REQUEST
18:16:00.707 -> 
Content-Length: 0
18:16:00.707 -> 
Connection: Close

Please help me, thanks you guys.

It seems unlikely that the code should have asterisks in so many places. What does your server expect?

The code has asterisks because i have censored my personal information liks wifi ssid, wifi password and the server links.

Either the URL of the site is incorrect or your credentials are wrong
Googling for "Unable to authenticate using access token" will show you that this error sometimes occured with Postman but the problem was fixed.

The library you are using seems to be sending raw HTTP requests. i.e the only thing you are providing the server is "GET /test HTTP/1.1". Some servers give you a "Bad Request" error when you do this.

When you browse websites with an actual browser a lot more is sent to the server. This is an example for this site:

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 Waterfox/56.2.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Cookie: ****
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0

These are called HTTP headers. Not all of them are essential tho. Try sending these lines one by one after sending your "GET" request:

Host: *******
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Connection: close

Like this:

/* Send the request */
wifly.println("GET /test HTTP/1.1");
wifly.println("Host: *******");
wifly.println("User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0");
wifly.println("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
wifly.println("Connection: close");

If this didn't work either you have to open the URL in your browser and use the developer tools of your browser to see the actual HTTP headers that are being sent and by trial and error find out which ones stop the "Bad Request" error.