thisbejim / Pyrebase

A simple python wrapper for the Firebase API.
2.07k stars 528 forks source link

Unable to create a custom ID token without a service account #359

Open alvindraper opened 4 years ago

alvindraper commented 4 years ago

Im getting the error AttributeError: 'NoneType' object has no attribute 'service_account_email'. I looked this up and saw that a service account was needed. Was a method where you can use a normal email and give it its own custom id developed?

DizzyduckAR commented 4 years ago

pyrebase cant send auth data. you need cloud function functions.auth.user().onCreate(user => ...

you can view the function and a working project or Easy Base with Ready to use Cloud Functions https://github.com/DizzyduckAR/LoginBase/blob/main/LoginBase%20Cloud%20Functions/index.js

once you upload the func to your project with firebase CLI any user registered on auth will get the const customClaims = { "NickName": "Free Pirate", "Time": "Free", "Token": "Free" };

into the real time DB with his UID as key (you can view the DB on the main readme.md