kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
994 stars 163 forks source link

Undefined property always whenever tries to use signInWithEmailAndPassword or getUserByEmail #88

Closed sakjain02 closed 3 years ago

sakjain02 commented 3 years ago

If user exist in firebase I am calling $auth->signInWithEmailAndPassword($user->email,$request->password) and getting this error on login "Undefined property: Kreait\Firebase\Auth\SignInResult::$uuid"

Second case when using $auth->getUserByEmail($email)-- Undefined property: Kreait\Firebase\Auth\UserRecord::$uuid"

If user doesn't exist in firebase I am calling $auth->createUserWithEmailAndPassword($user->email, $request->password); Then it is creating entry successfully. But the problem is when I sign in Package version 3.1 PHP 7.3 Laravel 8

Thank You

jeromegamez commented 3 years ago

createUser* and getUser* return a UserRecord - here you can access the Firebase User ID via the uid property, see https://firebase-php.readthedocs.io/en/5.x/user-management.html#user-records

When you sign in a user with one of the signIn* methods, a SignInResult is returned - here you can access the Firebase User Id via the firebaseUserId() method, see https://firebase-php.readthedocs.io/en/5.x/authentication.html#custom-authentication-flows

A uuid property is exposed nowhere, I wonder why you thought it was 😅

sakjain02 commented 3 years ago

Thank You. For pointing out the mistake I did. 😅