firebase-admin-python icon indicating copy to clipboard operation
firebase-admin-python copied to clipboard

How to login with email and password in firebase from python using Firebase Admin Python SDK?

Open koushikromel opened this issue 3 years ago • 2 comments

This is my first question on GitHub so i thought i should write it as much as detailed if my question was too long kindly excuse me.

I'm using Pyrebase(a third party package to access firebase data) now I'm looking forward to migrate to Firebase Admin Python SDK for all my works i couldn't find this particular thing in firebase-admin

In Pyrebase i use these commands to create and login to my account using python To create a new user auth.create_user_with_email_and_password(email, password) To login with email and password user = auth.sign_in_with_email_and_password(email, password)

In Firebase Admin Python SDK I can create an auth with create a new user firebase_admin.auth.create_user(**kwargs) create user documentation page like i do in Pyrebase No issues with this.

But i couldn't find a way to login with password, here it takes email as a parameter and returns the user details firebase_admin.auth.get_user_by_email(email, app=None) get user documentation page

So my question here is how do i authenticate user by login page by getting user email and password I wanna know is there any other way to authenticate users in Firebase Admin Python SDK

koushikromel avatar Sep 07 '22 08:09 koushikromel

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Sep 07 '22 08:09 google-oss-bot

Hey, Check below:

user = auth.create_user_with_email_and_password(email, password)

signin = auth.sign_in_with_email_and_password(email, password)

You can sign in with the above

arnavmehta7 avatar Sep 15 '22 02:09 arnavmehta7

Hi @koushikromel The Admin SDK is used in environments with administrative privileges and login to a user account is not currently a use case that is supported by the SDK. You would want to use one of the Firebase client-side SDKs (iOS, JS, Android etc.) to sign in users from the client side code.

You can use the ID token verification API in the Admin SDK to know what user is signed in on the client side by sending the token from the client to the server and then validating it on the server side. See https://firebase.google.com/docs/auth/admin/verify-id-tokens for more on that.

lahirumaramba avatar Oct 18 '22 21:10 lahirumaramba