I am working with Firebase and AngularJS. I am using Auth authentication for google login and i completed the process.Now i need to retrieve the user data that is stored in local storage like firebase:authUser:.
Once i login with google account in local storage you have firebase:authUser:.created and i need to fetch these details.
I used the following method to store user data
firebase.database().ref('users/' + user.uid).set
({
name: user.displayName,
email: user.email,
token: token
});
There are two ways to download files with Firebase Storage, using references in the SDK or a download URL. iOS and Android users can download files into memory, disk, or from a download URL. The web SDK can download files just from a download URL. StorageReference storageRef = FirebaseStorage.
Firebase Storage - Firebase Storage lets you upload and store user generated content, such as files, and images. Firebase Authentication - Firebase helps you authenticate and manage users who access your application. Create and setup your account - Get started using Firebase for free.
If the user login with a custom "email/password" you don't know anything else about that user (apart from the unique user id). If a user login with Facebook, or with Google sign in, you can get other information like the profile picture url. It is explained here: firebase.google.com/docs/auth/android/… .
User properties Firebase users have a fixed set of basic properties—a unique ID, a primary email address, a name and a photo URL—stored in the project's user database, that can be updated by the user (iOS, Android, web).
Just to augment @Franciso Mateo's answer: the mentioned filtering, just returns the key (string) with which the serialized user object is stored in local storage. To get the actual deserialized user object, we need to read the item with this key from local storage:
const userKey = Object.keys(window.localStorage)
.filter(it => it.startsWith('firebase:authUser'))[0];
const user = userKey ? JSON.parse(localStorage.getItem(userKey)) : undefined;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With