User registration with Firebase

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Chivone
Newbie
Posts: 10
Joined: Wed Sep 05, 2018 11:28 am
Contact:

User registration with Firebase

#1 Post by Chivone » Thu Nov 21, 2019 9:18 am

I need help. I would like to connect my game with Firebase so that users can register and login.

I have tested to connect Python with Firebase for the creation of new users by following this tutorial: https://www.youtube.com/watch?v=f_3YFEEovCc

It works (in Python, not Renpy)! This would be the code:

Code: Select all

import pyrebase
import getpass

firebaseConfig = {
    "apiKey": "PRIVATE",
    "authDomain": "PRIVATE",
    "databaseURL": "PRIVATE",
    "projectId": "PRIVATE"
    "storageBucket": "PRIVATE",
    "messagingSenderId": "PRIVATE",
    "appId": "PRIVATE",
}

firebase = pyrebase.initialize_app(firebaseConfig)

auth = firebase.auth()

email = input("Enter your email: \n")
password = getpass.getpass("Enter your password: \n")

login = auth.sign_in_with_email_and_password(email, password)

print("User created")
However, I don't know how to transfer it to Renpy. I have managed to import pyrebase and getpass libraries, but I don't know how to represent Python code in Renppy. Could anyone help me please?

Chivone
Newbie
Posts: 10
Joined: Wed Sep 05, 2018 11:28 am
Contact:

Re: User registration with Firebase

#2 Post by Chivone » Thu Nov 21, 2019 1:54 pm

I tried this code, but it doesn't work.... :(

Code: Select all

init python:
    import pyrebase
    import getpass
    
    def email_func(newstring):
        store.email = newstring
        
    def password_func(newstring):
        store.password = newstring
    
    def registro_func():
	firebaseConfig = {
    		"apiKey": "PRIVATE",
    		"authDomain": "PRIVATE",
    		"databaseURL": "PRIVATE",
    		"projectId": "PRIVATE"
    		"storageBucket": "PRIVATE",
    		"messagingSenderId": "PRIVATE",
    		"appId": "PRIVATE",
        }
        firebase = pyrebase.initialize_app(firebaseConfig)
        auth = firebase.auth()
        login = auth.sign_in_with_email_and_password(email_func, password_func)


screen login():

    textbutton "{color=#ffffff}CREATE ACCOUNT" xpos 220 ypos 1050 action [Function(registro_func), Jump("start")]

Pixellines1
Newbie
Posts: 7
Joined: Thu Nov 04, 2021 11:44 am
Contact:

Re: User registration with Firebase

#3 Post by Pixellines1 » Sun Nov 07, 2021 3:39 am

bump

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: User registration with Firebase

#4 Post by Ocelot » Sun Nov 07, 2021 3:50 am

What exactly doesn't work? Does it not launch? Does it launch, but throws an error when you try to log in? Does it lauinch, but no login happening? Something else?
< < insert Rick Cook quote here > >

Post Reply

Who is online

Users browsing this forum: No registered users