Ad

Firebase Authentification Via GitHub: Setting The Uid

I want to allow users to sign in/up via GitHub and via email/password using firebase.

In the server side, I implemented using the firebase_admin SDK, the email/password like it:

user = auth.create_user(
            uid=submission["id"],  // customized id
            email=submission["email"],
            password=submission["pass"],
            display_name=submission["name"] + " " + submission["lastName"])

It worked fine, but I want to get the same result when signing up via GitHub. That is, I want to be able to set my own uid. Notice that I want the code being mostly on the server side. And I want the user to click on the same button to either sign in or sign up.

I actually managed to authenticate the user with a custom uid from the server side using the next code taken from the firebase documentation:

provider_data=[ # user with Google provider
            auth.UserProvider(
                uid='google-uid',
                ...

But I don't understand how to sign in once the authentication is over. Is the sign in code should be in the client side?

Ad

Answer

Signing in always happens on the client, and never on the server. All you can do with the Firebase Admin SDK is create, delete, and modify accounts. The end user must provide credentials for that account when signing in to the client app.

Ad
source: stackoverflow.com
Ad