mobizt / FirebaseClient

🔥Async Firebase Client for Arduino. Supports Realtime Database, Cloud Firestore Database, Firebase Storage, Cloud Messaging, Google Cloud Functions and Google Cloud Storage.
MIT License
136 stars 8 forks source link

fix `auth_data_type` in `NoAuth` #42

Closed 0x9fff00 closed 7 months ago

0x9fff00 commented 7 months ago

Currently the NoAuth class sets auth_data_type to user_auth_data_undefined, but the conditions for skipping authentication instead check for user_auth_data_no_token, which isn't set anywhere. See e.g. the following code:

https://github.com/mobizt/FirebaseClient/blob/76acb46b3b9e3966a870a6ef478ad993e7ed5d77/src/core/AsyncClient/AsyncClient.h#L527-L540

https://github.com/mobizt/FirebaseClient/blob/76acb46b3b9e3966a870a6ef478ad993e7ed5d77/src/database/RealtimeDatabase.h#L949-L950

The former causes FIREBASE_ERROR_UNAUTHENTICATE errors when NoAuth is used which doesn't make sense. The latter causes ?auth=<auth_token> (with the placeholder) to be appended to URLs which seems to be incompatible with server-sent events.

Fix this by using user_auth_data_no_token instead.

mobizt commented 7 months ago

Thanks for the fix.