Posts

Showing posts with the label firebase-authentication

Behaviour of firebase.auth().currentUser

Behaviour of firebase.auth().currentUser In my app, I use firebase for user management. Now there is an admin account and I wish to create a new account from inside the admin account. In the database, the admin account is just another user account with a key value pair category:"admin" in it. Now, I use the following code in my app to create a new user and this code runs with admin logged in : try{ await firebase.auth().createUserWithEmailAndPassword(email,password) console.log(firebase.auth().currentUser) } catch(error) { await this.setState({message:error.message}) } What would this log? The admin user or the newly created user? If it logs the admin user, is there a function to get the new user or will I have to loop through the users finding the email? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and...

Firebase Auth: can't instantiate AuthCredential

Image
Firebase Auth: can't instantiate AuthCredential I am trying to make a Master User module, which user can delete other users. I read from other questions, that if you want to delete a user, You must logged in as that user. And then, I realize that you could sign in with credential information stored by firebase auth. (for references, I use google, facebook and email method). I also store a User entity in my Firebase Database which correspond to Firebase Auth. Here is my User class : public class User { // variables. private String appId; private String email; private String name; private String description; private String photoUrl; private boolean isAdmin; private boolean isSuspended; private boolean isDeleted; private AuthCredential credential; // all those getters and setters go here. } Notice that I store a AuthCredential instance in my user, which I set for the first time when I sign up this ...

How to link Alexa with cloud firestore

How to link Alexa with cloud firestore I have created the credential in Google cloud platform and when I link my Alexa skill it returns an access token. var accessToken = this.event.session.user.accessToken; console.log(accessToken); admin.auth().verifyIdToken(accessToken) .then(function(decodedToken) { var uid = decodedToken.uid; console.log(uid); // ... }).catch(function(error) { console.log(error); // Handle error }); Error: Decoding Firebase ID token failed. Make sure you passed the entire string JWT which represents an ID token. I cannot use this access token to authenticate in firebase. They give me the above error and asks gor google ID token – Mohan Burman Jun 29 at 9:11 By clicking "Post Your Answer", you acknowledge that you have read our upda...