1

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.

Suraj Vaishnav
  • 7,777
  • 4
  • 43
  • 46
Mostafa Khaled
  • 372
  • 4
  • 16

2 Answers2

1

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.

Suraj Vaishnav
  • 7,777
  • 4
  • 43
  • 46
0

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

MML
  • 44
  • 1
  • 8
  • 21
Mostafa Khaled
  • 372
  • 4
  • 16