2

What I want is to perform rest requests to Firebase Realtime Database from my esp8266 with micropython firmware without complex authorization process.
I know that I can turn off authorization at all in the rules but I'd prefer to have at least some basic security.

Can't I just use my Web API Key for this purpose? project settings

Here is a doc which tells that there are 2 ways of authentication: oauth2 and generating key manually. Second way seems almost what I need but it requires setting up Admin SDK and as far as I understood still requires regenerating the key from time to time.

So eventually I have no answer to a simple question: how to authenticate rest requests to the Firebase Realtime Database in the most simple way?

1 Answer 1

3

The same page you linked to contains a section on using legacy tokens (also known as "database secrets" in the past). While those are not recommended anymore, they continue to work and are as simply as adding the (non-dynamic) database secret to your URLs.

I suggest you read the links at the bottom of the documentation. But I do recommend that you switch to using the OAuth or ID Token flows as those are much more secure.

Sign up to request clarification or add additional context in comments.

2 Comments

Seems that this option isn't simple enough.. Documentation points to this library: github.com/firebase/firebase-token-generator-python and it uses base64 which is not present in the firmware. So I tried to use this version: raw.githubusercontent.com/micropython/micropython-lib/master/… After that I get the next error each time I run the project: File firebase_token_generator.py, line 6, in <module> MemoryError: memory allocation failed, allocating 272 bytes 6th line is from base64 import urlsafe_b64encode
In other words: I need another solution such as just providing api key. Anyway, thanks for your answer.

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.