Getting response as 302 from nodemcu with basic authorization

Hi,
I an trying to connect an NodeMCU to a website but unfortunately only receiving httpcode 302 from a particular site ,while getting -1 from www.arduino.cc. i am able to fetch results from jsonplaceholder examples.

The same get query gives me response via postman, http code 200. The rest api is public,i.e gives response even without signing in.

According to w3 schools definition, 302 code is temporary,and i need to continue requesting.
How can i overcome this problem? Please help me this is very urgent.

The HTTP response status code 302 Found is a common way of performing URL redirection.

So, your browser or other software handles the redirection. Your code does not.

The redirect may be temporary, but almost never is. The site has moved. Get over it. The are most likely not moving back.

www.arduino.cc redirects to https. to test http use http://arduino.cc/asciilogo.txt

Hi,
Yes that is true.
Unfortunately my site redirect is https and not http,so when i write the https address it always returns me httpcode -1.

have tried fruitlessly but could not figure out yet.

you must use the https client of esp8266

Can you please give me a sample code for it?

I am following:

it is always better to search information at the relevant source, not everywhere on Internet

Juraj:
it is always better to search information at the relevant source, not everywhere on Internet

Arduino/libraries/ESP8266WiFi/examples/HTTPSRequest/HTTPSRequest.ino at master · esp8266/Arduino · GitHub

Thank you ill update you soon!

Juraj:
it is always better to search information at the relevant source, not everywhere on Internet

Arduino/libraries/ESP8266WiFi/examples/HTTPSRequest/HTTPSRequest.ino at master · esp8266/Arduino · GitHub

Unfortunately did not work for !
always connection failed, same for port 80
and website http://jsonplaceholder.typicode.com/users/1 (this gives me result in my code)!

Do you think issue is with my firmware?

Juraj:
it is always better to search information at the relevant source, not everywhere on Internet

Do you know the right place for the information?

1 Like

shariq_azim:
Do you think issue is with my firmware?Do you know the right place for the information?

what firmware? you use esp8266 arduino core. it is developed by a few people with small help of many other on GitHub. look into reported issues there