Closed back920096 closed 11 months ago
I assumed that you mean HTTPv1 API cloud messaging. This library does not support that, only legacy API supported.
You should use this library instead.
If you already used that library, you post in the wrong repository.
For ethernet with native support PHY (e.g., LAN8720) please follow this example.
For other SPI ethernet module (MAC), please use external client by follow this example and this example.
When you use external ethernet client, it is not in this library scope, and you should debug your ethernet client yourself.
You should post your code or create the simple code to replicate the issue and describe more error details.
But won't the old version of FCM stop serving next year?
Suwatchai K. @.***> 於 2023年7月19日 週三 下午12:42寫道:
You should post your code or create the simple code to replicate the issue and describe more error details.
— Reply to this email directly, view it on GitHub https://github.com/mobizt/Firebase-ESP32/issues/282#issuecomment-1641401327, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGW7Z4W5NH7HRIWCSJNCFXLXQ5QSPANCNFSM6AAAAAA2PJ44YI . You are receiving this because you authored the thread.Message ID: @.***>
I have no idea. You should ask Google supports.
Hello author, I would like to ask if there is any way to get the Bearer token in the esp32+w5500 solution? I plan to send FCM via http after getting the token I refer to https://github.com/mobizt/ESP-Signer I want to get token through this project Create an account according to the process and implement it but it is not successful Here is my code and error message
Thank you very much for your help [image: image.png] /**
*/
/**
*/
//In case of Gmail, to send the Email via port 465 (SSL), less secure app option should be enabled in the account settings. https://myaccount.google.com/lesssecureapps?pli=1
/** These credentials are taken from Service Account key file (JSON)
file.
file. const char PRIVATE_KEY[] PROGMEM = "-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----\n";
uint8_t Eth_MAC[] = {0x02, 0xF0, 0x0D, 0xBE, 0xEF, 0x01}; bool eth_connected = false;
void networkConnection() {
Ethernet.init(WIZNET_CS_PIN); ResetEthernet(); Serial.println("Starting Ethernet connection..."); while (Ethernet.linkStatus() != LinkON){ Serial.println("wait ethline"); Serial.println(Ethernet.localIP()); delay(500); } Serial.println("ethline finish"); IPAddress ip = Ethernet.localIP(); // Ethernet.begin(Eth_MAC); while(!Ethernet.begin(Eth_MAC,1000,4000)) { Serial.println("."); }
while (ip == IPAddress(0, 0, 0, 0)) { delay(500); ip = Ethernet.localIP(); Serial.println("wait ip"); } Serial.println(Ethernet.localIP()); Serial.println(ip); while (ip == IPAddress(0, 0, 0, 0)) { delay(500); ip = Ethernet.localIP(); Serial.println("wait ip"); } unsigned long to = millis(); while (Ethernet.linkStatus() == LinkOFF) { Serial.println("Wait Ethernet connection..."); delay(100); } Serial.print("Connected with IP "); eth_connected = true; Serial.println(Ethernet.localIP());
}
void ResetEthernet() { Serial.println("Resetting WIZnet W5500 Ethernet Board... "); pinMode(WIZNET_RESET_PIN, OUTPUT); digitalWrite(WIZNET_RESET_PIN, HIGH); delay(200); digitalWrite(WIZNET_RESET_PIN, LOW); delay(50); digitalWrite(WIZNET_RESET_PIN, HIGH); delay(200); }
SignerConfig config;
bool beginReady = false;
void tokenStatusCallback(TokenInfo info);
void begin() { beginReady = true;
/ Assign the sevice account credentials and private key (required) / config.service_account.data.client_email = CLIENT_EMAIL; config.service_account.data.project_id = PROJECT_ID; config.service_account.data.private_key = PRIVATE_KEY;
/ Expired period in seconds (optional). Default is 3600 sec./ config.signer.expiredSeconds = 3600;
/ Seconds to refresh the token before expired (optional). Default is 60 sec./ config.signer.preRefreshSeconds = 60;
config.token_status_callback = tokenStatusCallback;
config.signer.tokens.scope = " https://www.googleapis.com/auth/spreadsheets,https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/drive.file "; Signer.begin(&config); }
void setup() { Serial.begin(115200); Serial.println(); networkConnection();
}
void loop() { if (eth_connected && !beginReady) { begin(); }
//Check to status and also refresh the access token bool ready = Signer.tokenReady(); if (ready) { int t = Signer.getExpiredTimestamp() - config.signer.preRefreshSeconds - time(nullptr);
Serial.print("Remaining seconds to refresh the token, "); Serial.println(t); delay(1000); } }
void tokenStatusCallback(TokenInfo info) { if (info.status == esp_signer_token_status_error) { Serial.printf("Token info: type = %s, status = %s\n", Signer.getTokenType( info).c_str(), Signer.getTokenStatus(info).c_str()); Serial.printf("Token error: %s\n", Signer.getTokenError(info).c_str()); } else { Serial.printf("Token info: type = %s, status = %s\n", Signer.getTokenType( info).c_str(), Signer.getTokenStatus(info).c_str()); if (info.status == esp_signer_token_status_ready) Serial.printf("Token: %s\n", Signer.accessToken().c_str()); } }
Suwatchai K. @.***> 於 2023年7月19日 週三 下午2:05寫道:
I have no idea. You should ask Google supports.
— Reply to this email directly, view it on GitHub https://github.com/mobizt/Firebase-ESP32/issues/282#issuecomment-1641469398, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGW7Z4QBNLQA6C2Q3YWSUB3XQ52L5ANCNFSM6AAAAAA2PJ44YI . You are receiving this because you authored the thread.Message ID: @.***>
You don't need to use ESP-Signer library.
You can update the library to latest version 4.3.18.
And please don't forget to define this macro in FirebaseFS.h
#define FB_ENABLE_EXTERNAL_CLIENT
Then try this example.
hello author I would like to ask how to use firebase FCM OAUth2.0 with Ethernet I am using esp32s3 Irebase FCM OAUth2.0 can be used normally when I am on wifi Ethernet doesn't work