0

I was trying to connect to firebase using AT commands on ESP8266 (ESP01). Without authenticated rules I'm able to write to a node.

But with authenticated rules, I'm having a trouble getting Auth Key. With curl it is working fine but AT commands returns error.

These are the curl commands which works to get Auth key using web API key.

curl -X POST -d "Content-length:63" "https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=<API_KEY>&email=<email>&password=<password>&returnSecureToken=true"

which works fine and returns idToken that can be used as <Auth_key> for posting to firebase node like below.

curl -X PUT https://myproject-default-rtdb.asia-southeast1.firebasedatabase.app/UsersData/mynode.json?auth=<idToken>  -d "{\"Test\":\"data\"}"

But when I try using the same using AT commands with ESP8266 (ESP01) it does not works.

To get token key I tried to connect to server using below command,

AT+CIPSTART="SSL","https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=<API_KEY>",443

but it return error.

I tried also

1) AT+CIPSTART="SSL","https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword",443

2) AT+CIPSTART="SSL","https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=<API_KEY>&email=<email>&password=<password>&returnSecureToken=true",443

All returns error. How do I get token id from google API using AT command?

Below connection is successful, but I need to authenticate using token key.

AT+CIPSTART="SSL","myproject-default-rtdb.asia-southeast1.firebasedatabase.app",443
6
  • 1
    esp8266 AT firmware doesn't support TLS 1.2 and higher Commented Sep 4, 2024 at 14:38
  • Thanks for the hint. I was unaware of this. I will try update the ESP8266 AT firmware with github.com/JiriBilek/ESP_ATMod which claims support for TLS 1.2. Commented Sep 5, 2024 at 12:27
  • I tried AT+CIPSTART="SSL","https://identitytoolkit.googleapis.com",443 this command succeeded connecting to server. But consequent transfer returned error. Tried with original AT firmware and modified "github.com/JiriBilek/ESP_ATMod" firmware. Commented Sep 6, 2024 at 7:25
  • how are you invoking the AT commands? from a terminal? it is not possible to do a HTTP request that way Commented Sep 6, 2024 at 8:25
  • I use Arduino Serial Monitor. It is little difficult to use as we need to quickly send the data in seconds but it works with simple web links. Any how I can try by code, but what is the correct sequence of data to send for getting the Auth code? The below code succeeds presently AT+CIPSTART="SSL","https://identitytoolkit.googleapis.com",443 Commented Sep 7, 2024 at 12:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.