Giter Site home page Giter Site logo

micropython-firebase-auth's People

Contributors

wooldoughnut310 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

micropython-firebase-auth's Issues

I can read but not create

Hi,
I'm trying this library and fth firebase-firestore one.
I can connect to my database because I can read
But I can't write in it and I've no error message, then I can't know why

Firestore rules :

rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{user} {
allow read, write: if request.auth != null;
}
}
}

My code :

import os
import network
import time
import ujson, urequests, _thread

SSID = "SSID"
password = "password"
wlan = network.WLAN(network.STA_IF)
wlan.active(True)

if not wlan.isconnected():
wlan.connect(SSID, password)
print("Attente de la connexion WIFI", end="...")
while not wlan.isconnected():
print(".", end="")
time.sleep(1)
print()

print("Reseau WIFI", SSID , "connecté :", wlan.ifconfig()[0])

import ufirestore as firestore
from json import FirebaseJson
from firebase_auth import FirebaseAuth
from firebase_auth import AuthSession

firestore.set_project_id("firestore-db-test1")

auth = FirebaseAuth("API_KEY")
auth.sign_in("[email protected]", "AAAAAAA")

firestore.set_access_token(auth.session.access_token)

print("===== Lecture =====")
print("")
raw_doc = firestore.get("users/")
print("raw_doc : ", raw_doc)
print("")

print("===== Ecriture =====")
print("")
doc = FirebaseJson()
doc.set("Name/stringValue", "John Doe")
doc.set("Age/integerValue", 25)

response = firestore.create("users/", doc, bg=False)
print(response)

auth.sign_out()

The results :

===== Lecture =====

raw_doc : {'documents': [{'fields': {'Age': {'stringValue': '21'}, 'Name': {'stringValue': 'Jane Doe'}}, 'createTime': '2022-10-31T12:32:34.756017Z', 'name': 'projects/firestore-db-test1/databases/(default)/documents/users/FhjDBdURqcaQlpwdXlFG', 'updateTime': '2022-10-31T12:32:34.756017Z'}]}

===== Ecriture =====

Traceback (most recent call last):
File "", line 92, in
File "ufirestore.py", line 222, in create
File "ufirestore.py", line 90, in create
File "ufirestore.py", line 53, in send_request
File "urequests.py", line 104, in request
AssertionError:

I need help because I really don't know I happened

Thanks in advance

micropython-firebase-auth library not available in the latest micropython (1.20.0) version

The newly changed package manager mip can neither find any micropython-firebase related libraries, nor does the latest micropython have 'upip'.
This implies neither
import upip
upip.install('xyz-related-to-firebase')
nor
import mip
mip.install('xyz-related-to-firebase')
will work.

WORK-AROUND
Use an older version of micropython (I wish I got this idea sooner my problems would've been solved by now smh.)

WARNING
I don't know what libraries are available with the new mip package manager other than firebase-related libraries. I suggest checking them and mentioning the version of micropython compatible with them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.