firebase-authentication

How to maintain Firebase Auth for multiple pages on the web?

末鹿安然 提交于 2019-12-21 11:22:35
问题 I am using Firebase for a web application. The goal is to allow a familiar log-in/sign-up where the user signs up or logs in one one page, and upon successful authentication, is brought to the home page. The flow would look something like this: Log-in/Sign-up -> (allows access to) -> [Home, Profile, Search, Friends, etc.] I am using Javascript (No AngularJs since I am unfamiliar with it entirely). The problem I am having is that once the user successfully logs in or signs up, their "user

Firebase Auth, how to know new user signed up, rather than existing user sign in?

旧城冷巷雨未停 提交于 2019-12-21 10:55:17
问题 My use case is that I want to ask newly signed up users to enrich basic info like their names. So I was hoping to do it like: firebase.auth().onAuthStateChanged(function(user) { if (user) { // User is signed in. if (some indicator tells me it is newly signed up user) {redirect to a form to fill in more info} } else { // No user is signed in. } }); I checked the doc, and could not find anything related to this... Thanks for the help in advance. 回答1: Since version 4.6.0: https://firebase.google

Linking Google Assistant with Firebase Auth

拥有回忆 提交于 2019-12-21 04:23:08
问题 I am attempting to connect a Google Assistant app using DialogFlow(Api.AI) with Firebase Auth. My App uses Firebase Auth to maintain user accounts and the realtime database to store data. I would like to be able to make changes to a user's data through the Google Assistant, maybe using something like a cloud function. In order to make any user changes through Google Assistant, I need to link the user's Google Assistant account with their Firebase Auth account. The current mechanism appears to

Is the firebase access token refreshed automatically?

大兔子大兔子 提交于 2019-12-21 04:05:06
问题 I'm using the Firebase email/password authentication. After the user has signed in successfully I query the access token the following way: FirebaseUser mUser = FirebaseAuth.getInstance().getCurrentUser(); mUser.getIdToken(true) .addOnCompleteListener(new OnCompleteListener<GetTokenResult>() { public void onComplete(@NonNull Task<GetTokenResult> task) { if (task.isSuccessful()) { String idToken = task.getResult().getToken(); // Send token to your backend via HTTPS // ... } else { // Handle

Delete Firebase anonymous users after a while

房东的猫 提交于 2019-12-21 03:43:07
问题 I am using anonymous auth to allow my users to use the app without logging in. However, Firebase seems to persist these anonymous user IDs indefinitely. Is there a way to automatically purge these or set some sort of expiration rule? I don't want these one-time use IDs to live forever and clutter the actual user data from providers. 回答1: Unfortunately this is a "memory leak" (user leak?) Since there is no reasonable way to force an anonymous user to convert, these anonymous user ids will soon

How to create different user groups in Firebase?

依然范特西╮ 提交于 2019-12-21 03:21:20
问题 I am making a point of sale app, using Xcode. I want this app to keep track of stock items, allow users to search stock, scan stock, add or lookup stock using a barcode. Items of stock will be stored in a users 'store'. I want to have three types of users: A manager user , who creates a store and has full access to the store. He can manage all of the 'employee users', such as deleting their access and employee users must be invited by him to join his store using a unique code. He will have

Firebase 9.0.0- How to see if user is logged in with AuthStateListener

倾然丶 夕夏残阳落幕 提交于 2019-12-21 03:19:22
问题 With Google's Firebase AuthStateListener, I'm not sure how to detect if the Auth token has expired. I'm using email and password authentication and the listener works correctly for the first time users open the app and logs them in automatically on subsequent app launches. Problem arises when their login token expires and the user should have to re-authenticate. The AuthStateListener just logs them in, but the Firebase service denies them access because their token has expired. My Listener

How to manage users' different authentication in firebase

梦想的初衷 提交于 2019-12-21 03:16:32
问题 please help me finding correct solution in the following situation. I am developing ios app with swift which will use Firebase as a backend. Users should be able to login into firebase with email/password or/and with facebook. Maybe google will be added later. It is important for me to have one firebase account for each real user as user will have reward points and it won't make sense if on one devise(with email login) he will have X points and on other device(with facebook) he will have

How to re-authenticate a user on Firebase with Google Provider?

核能气质少年 提交于 2019-12-21 03:16:14
问题 The example for using reauthenticate() in Firebase shows only how to re-authenticate a user who signed with Email and Password : AuthCredential credential = EmailAuthProvider.getCredential("user@example.com", "password1234"); FirebaseAuth.getInstance().getCurrentUser().reauthenticate(credential); I also know how to re-authenticate with Facebook Provider ( credential = FacebookAuthProvider.getCredential(AccessToken.getCurrentAccessToken().toString()) ). Problem is there's no equivelant method

Firebase .getUID NullPointerException when authen

我的梦境 提交于 2019-12-21 02:41:42
问题 I will add data to database when I register, but I got Java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.FirebaseUser.getUid()' on a null object reference I try something, but don't work Here's My code auth = FirebaseAuth.getInstance(); database = FirebaseDatabase.getInstance(); mRef = database.getReference(); FirebaseUser user = auth.getCurrentUser(); userID = user.getUid(); btnSignUp.setOnClickListener(new View.OnClickListener() {