I am using firebase authentication in my Android app. I am using google button to sign to my app but I have a problem with that. The button is used to sign up users to my app if they don't have an account on the app and in the same time the button also signed in users who has account on my app I need to find a way to find out if the user has signed up to the first time in my app or he has an account before.
2 Answers
That's very simple each time you click on google login button you receive detail like name, email address, id. If user click on google button you have to check if this email address is already registered or not if not registered then you have to store these detail into database, if already registered then you can log in.
Basic idea is first time when you receive someones detail you need to store it into database, once it is stored whenever this user clicks on google button again, you have these details already proceed with login.
you can use id or email address to check uniqueness.

- 7,777
- 4
- 43
- 46
-
My question is how to check that .I was going to make query in the database about the user but I was wondering if there is an easier way – Mostafa Khaled Sep 28 '18 at 16:37
-
I have edited my answer take a look, if you find something new. – Suraj Vaishnav Sep 28 '18 at 16:40
-
What is the easiest way to check if the user is signed in or not using its email – Mostafa Khaled Sep 28 '18 at 16:43
-
Update your answer with the code and I will accept it – Mostafa Khaled Sep 28 '18 at 16:45
-
which dbms are you using? – Suraj Vaishnav Sep 28 '18 at 16:53
-
I am using firebase – Mostafa Khaled Sep 28 '18 at 16:54
-
I know the how these things work, i don;t know how to program it with firebase. – Suraj Vaishnav Sep 28 '18 at 16:56
I have solved the problem by storing the users by their UID then in any time the Google sign pressed if the user's ID is exist in the database I do nothing else I push the data of the user

- 44
- 1
- 8
- 21

- 372
- 4
- 16