@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_in); // Assign fields mSignInButton = (SignInButton) findViewById(R.id.sign_in_button); // Set click listeners mSignInButton.setOnClickListener(this); // Configure Google Sign In GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); // Initialize FirebaseAuth mFirebaseAuth = FirebaseAuth.getInstance(); }
private void getUserObject(){ mAuth = FirebaseAuth.getInstance(); userID = mAuth.getCurrentUser().getUid(); token = FirebaseInstanceId.getInstance().getToken(); mUserManager = new UserManager(); mUserManager.getUser(userID, new IGetUserListener() { @Override public void onGetSingleUser(User retrievedUser) { mUser = retrievedUser; // 11/28/17 JD: then instantiate the UI so that we can't move forward until a user value is found createStartShiftButton(); } @Override public void onFailedSingleUser() { // 11/28/17 JD: do something to avoid catastrophic failure } }); }
private void handleMessage(RemoteMessage remoteMessage) { Intent intent = new Intent(this, FirebaseAuth.getInstance().getCurrentUser() == null ? LoginActivity.class:MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent intent1 = PendingIntent.getActivity(this,0,intent,PendingIntent.FLAG_ONE_SHOT); Uri defaultURI = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder builder = new NotificationCompat.Builder(this,NotificationCompat.CATEGORY_MESSAGE) .setSmallIcon(R.drawable.gdg_notification_icon) .setContentTitle(remoteMessage.getNotification().getTitle()) .setContentText(remoteMessage.getNotification().getBody()) .setAutoCancel(true) .setSound(defaultURI) .setContentIntent(intent1); NotificationManager manager = ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)); if (manager != null) { manager.notify(23,builder.build()); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); int id = item.getItemId(); switch (item.getItemId()) { case R.id.sign_out_menu: FirebaseAuth.getInstance().signOut(); Intent intent = new Intent(SectionsActivity.this, StartActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); finish(); return true; case R.id.action_settings: Intent settings = new Intent(this, SettingsActivity.class); startActivity(settings); return true; default: return super.onOptionsItemSelected(item); } }
@Override public void signUp(final String email, final String password) { FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, password) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { postEvent(LoginEvent.onSignUpSuccess); signIn(email, password); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { postEvent(LoginEvent.onSignUpError, e.getMessage()); } }); }
@Test @SuppressWarnings("ConstantConditions") public void signInFailure_ShowsErrorMessage() throws Exception { FirebaseAuth.getInstance().signOut(); FakeAuthConnector.setFakeSuccess(false); createActivity(); // error message should be showing: Espresso.onView(withId(R.id.progressBar)).check(matches(not(isDisplayed()))); Espresso.onView(withId(R.id.textMessage)).check(matches(isDisplayed())); Espresso.onView(withId(R.id.buttonContinue)).check(matches(isDisplayed())); // double check that the home screen is not shown: Espresso.onView(withId(R.id.recyclerContent)).check(doesNotExist()); }
@Override public void authListener(final OnLoginFinishedListener listener){ mAuthListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { user = firebaseAuth.getCurrentUser(); if (user != null) { if(signInWithGoogle){ listener.onLoginGoogleSuccess(); } else if(registerWithMail){ listener.onRegisterMailSuccess(); } else { listener.onLoginMailSuccess(); } } else { // User is signed out // Log.d(TAG, "onAuthStateChanged:signed_out"); } } }; }
@Override public void getAllUsersFromFirebase() { FirebaseDatabase.getInstance().getReference().child(Constants.ARG_USERS).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Iterator<DataSnapshot> dataSnapshots = dataSnapshot.getChildren().iterator(); List<User> users = new ArrayList<>(); while (dataSnapshots.hasNext()) { DataSnapshot dataSnapshotChild = dataSnapshots.next(); User user = dataSnapshotChild.getValue(User.class); if (!TextUtils.equals(user.uid, FirebaseAuth.getInstance().getCurrentUser().getUid())) { users.add(user); } } mOnGetAllUsersListener.onGetAllUsersSuccess(users); } @Override public void onCancelled(DatabaseError databaseError) { mOnGetAllUsersListener.onGetAllUsersFailure(databaseError.getMessage()); } }); }
/** * {@inheritDoc} */ @Override public GdxFirebaseUser getCurrentUser() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) return null; UserInfo.Builder builder = new UserInfo.Builder(); builder.setDisplayName(user.getDisplayName()) .setPhotoUrl(user.getPhotoUrl() != null ? user.getPhotoUrl().getPath() : null) .setProviderId(user.getProviderId()) .setUid(user.getUid()) .setIsEmailVerified(user.isEmailVerified()) .setIsAnonymous(user.isAnonymous()) .setEmail(user.getEmail()); return GdxFirebaseUser.create(builder.build()); }
/** * Delete a user from the database */ public void deleteUserFromDatabase() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user != null) { String userId = user.getUid(); getDatabaseManager().deleteUserRecords(getActivity(), userId); user.delete().addOnCompleteListener(new OnCompleteListener<Void>() { /** * Delete the user task completed * @param task - the completed task */ @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { mUser = null; } } }); resetDatabaseManager(); } }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_contact_us) { contactUs(); return true; }else if (id == R.id.action_logout) { //facebook logout LoginManager.getInstance().logOut(); //firebase logout FirebaseAuth.getInstance().signOut(); logout = true; startActivity(new Intent(this,LoginActivity.class)); return true; }else if (id == R.id.item_samplebadge) { Intent intent = new Intent(this,ShoppingCardActivity.class); intent.putParcelableArrayListExtra("order",cardItems); startActivity(intent); return true; } return super.onOptionsItemSelected(item); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_journal_list, container, false); // Set the adapter if (view instanceof RecyclerView) { FirebaseDatabase dbRef = FirebaseDatabase.getInstance(); FirebaseAuth auth = FirebaseAuth.getInstance(); FirebaseUser user = auth.getCurrentUser(); DatabaseReference userRef = dbRef.getReference(user.getUid()); userRef.addChildEventListener (chEvListener); userRef.addValueEventListener(valEvListener); Context context = view.getContext(); RecyclerView recyclerView = (RecyclerView) view; if (mColumnCount <= 1) { recyclerView.setLayoutManager(new LinearLayoutManager(context)); } else { recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount)); } adapter = new JournalAdapter(allTrips, mListener); recyclerView.setAdapter(adapter); } return view; }
private void getProviderData() { // [START get_provider_data] FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user != null) { for (UserInfo profile : user.getProviderData()) { // Id of the provider (ex: google.com) String providerId = profile.getProviderId(); // UID specific to the provider String uid = profile.getUid(); // Name, email address, and profile photo Url String name = profile.getDisplayName(); String email = profile.getEmail(); Uri photoUrl = profile.getPhotoUrl(); }; } // [END get_provider_data] }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mView = inflater.inflate(R.layout.frag_request,container,false); mRequests = new ArrayList<>(); mAuth = FirebaseAuth.getInstance(); mAuthListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { mUser = firebaseAuth.getCurrentUser(); } }; //mRequests.add(new Request("Name1","9PM")); //mRequests.add(new Request("Name2","9PM")); //mRequests.add(new Request("Name3","9PM")); initViews(); setUpRecyclerView(); getRequests(); return mView; }
@Override public void checkLoggedInStatus(final Callbacks.IRequestCallback callback) { Library.getFirebaseAuth() .addAuthStateListener(new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { FirebaseUser user = firebaseAuth.getCurrentUser(); if(user == null){ // Not logged in callback.onError(); }else { //Logged in callback.onSuccess(); } } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // initialize all views signUpLayout = findViewById(R.id.layout_sign_up); verificationLayout = findViewById(R.id.layout_verification); phoneNoEditext = (EditText) findViewById(R.id.editText_phone_no); verificationCodeEditext = (EditText) findViewById(R.id.editText_verification_code); okayButton = (Button) findViewById(R.id.button_okay); verifyButton = (Button) findViewById(R.id.button_verify); okayButton.setOnClickListener(this); verifyButton.setOnClickListener(this); // initilize auth parameter auth = FirebaseAuth.getInstance(); }
@Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { FirebaseAuth firebaseAuth = SessionManager.getFirebaseAuth(); FirebaseUser currentUser = SessionManager.getFirebaseUser(); boolean isEmailVerified = currentUser.isEmailVerified(); // TODO zmienić z powrotem if (true) { updateLoginConfigInSharedPrefs(); SessionManager.initializeCurrentUserFirebaseListeners(); SessionManager.initializeFamilyMembersFirebaseListener(); Intent intent = new Intent(context, MainActivity.class); context.startActivity(intent); } else { firebaseAuth.signOut(); Toast.makeText(context, R.string.email_not_verified, Toast.LENGTH_LONG).show(); } } else { logger.logWarn("Sign In Failure: " + task.getException()); Toast.makeText(context, R.string.invalid_email_or_password, Toast.LENGTH_LONG).show(); } }
@Override public void logout(final Callbacks.IRequestCallback callback) { // Logout user in Firebase. Library.getFirebaseAuth().signOut(); // Listen when it done Library.getFirebaseAuth() .addAuthStateListener(new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { // If sucess, currentUser shold be null if(firebaseAuth.getCurrentUser() != null){ // An error occour when trie to logout reportError(callback); return; } // Logout success callback.onSuccess(); } }); }
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_instellingen, container, false); // Initialize button & set onClickListener Button uitlogBtn = (Button) view.findViewById(R.id.uitlogBtn); uitlogBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FirebaseAuth.getInstance().signOut(); FirebaseHelper.userRef = null; Intent intent = new Intent(getActivity(), LoginActivity.class); startActivity(intent); getActivity().finish(); } }); return view; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_splash); new Handler().postDelayed(new Runnable(){ public void run(){ FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser(); if (currentUser == null) { Intent intent = new Intent(SplashActivity.this, LoginActivity.class); startActivity(intent); finish(); } else { startActivity(new Intent(SplashActivity.this,MainActivity.class)); finish(); } }; }, DURACION_SPLASH); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mMainView = inflater.inflate(R.layout.fragment_friends, container, false); mFriendsList = (RecyclerView) mMainView.findViewById(R.id.friends_list); mAuth = FirebaseAuth.getInstance(); mCurrent_user_id = mAuth.getCurrentUser().getUid(); mFriendsDatabase = FirebaseDatabase.getInstance().getReference().child("Friends").child(mCurrent_user_id); mFriendsDatabase.keepSynced(true); mUsersDatabase = FirebaseDatabase.getInstance().getReference().child("Users"); mUsersDatabase.keepSynced(true); mFriendsList.setHasFixedSize(true); mFriendsList.setLayoutManager(new LinearLayoutManager(getContext())); // Inflate the layout for this fragment return mMainView; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); auth = FirebaseAuth.getInstance(); // this listener will be called when there is change in firebase user session authStateListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { FirebaseUser user = firebaseAuth.getCurrentUser(); if (user == null) { // user auth state is changed - user is null // launch login activity context.startActivity(new Intent(context, LoginActivity.class)); } } }; auth.addAuthStateListener(authStateListener); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.user_login); mAuth = FirebaseAuth.getInstance(); emailEditText = (EditText) findViewById(R.id.input_email); passwordEditText = (EditText) findViewById(R.id.input_password); Button loginButton = (Button) findViewById(R.id.btn_login); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { signIn (); } }); //mStatusTextView = (TextView) findViewById(R.id.status); // mDetailTextView = (TextView) findViewById(R.id.detail); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.logoutItem) { FirebaseAuth.getInstance().signOut(); startActivity(new Intent(getApplicationContext(), OpenScreen.class)); finish(); } return super.onOptionsItemSelected(item); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); ButterKnife.bind(this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); VCard vCard = new VCard(); vCard.setName(firebaseUser.getUid()); qrImageView.setImageBitmap(QRCode.from(vCard.buildString()).bitmap()); databaseReference = FirebaseDatabase.getInstance().getReference(); currentUser = FirebaseAuth.getInstance().getCurrentUser(); sharedPreferences = getSharedPreferences("user", MODE_PRIVATE); try { populateProfile(); } catch (Exception e) { LogHelper.e(TAG, e.toString()); } }
private void taskChaining() { // [START task_chaining] Task<AuthResult> signInTask = FirebaseAuth.getInstance().signInAnonymously(); signInTask.continueWithTask(new Continuation<AuthResult, Task<String>>() { @Override public Task<String> then(@NonNull Task<AuthResult> task) throws Exception { // Take the result from the first task and start the second one AuthResult result = task.getResult(); return doSomething(result); } }).addOnSuccessListener(new OnSuccessListener<String>() { @Override public void onSuccess(String s) { // Chain of tasks completed successfully, got result from last task. // ... } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { // One of the tasks in the chain failed with an exception. // ... } }); // [END task_chaining] }
private void sendVerificationEmail() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); user.sendEmailVerification() .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { // Email sent finish(); } else { // overridePendingTransition(0, 0); // finish(); // overridePendingTransition(0, 0); // startActivity(getIntent()); sendVerificationEmail(); } } }); }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); break; case R.id.action_logout: FirebaseAuth.getInstance().signOut(); onBackPressed(); break; case R.id.action_info: final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder .setMessage("Show this QR Code at the registration desk to complete " + "general registration. You will have to pay the respective amount " + "for each event at its location.") .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).show(); break; } return super.onOptionsItemSelected(item); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); FirebaseApp.initializeApp(this); FirebaseAuth.getInstance().addAuthStateListener(this); FirebaseAuth.getInstance().signInAnonymously() .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { Log.d(TAG, "signInAnonymously:onComplete:" + task.isSuccessful()); // If sign in fails, display a message to the user. If sign in succeeds // the auth state listener will be notified and logic to handle the // signed in user can be handled in the listener. if (!task.isSuccessful()) { Log.w(TAG, "signInAnonymously", task.getException()); Toast.makeText(TestActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show(); } } }); }
private void updatePassword() { // [START update_password] FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); String newPassword = "SOME-SECURE-PASSWORD"; user.updatePassword(newPassword) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG, "User password updated."); } } }); // [END update_password] }
@Override public void onLocationChanged(Location location) { FirebaseAuth auth = FirebaseAuth.getInstance(); String uid = auth.getCurrentUser().getUid(); DatabaseReference ref = FirebaseDatabase.getInstance().getReference().child("users"); ref.child(uid).child("location").setValue(new Loc(location.getLatitude(), location.getLongitude())); SharedPreferences prefs = context.getSharedPreferences("USER_DATA", 0); String group_id = prefs.getString("GROUP_ID", ""); GeoHash geoHash = new GeoHash(location.getLatitude(), location.getLongitude()); Map<String, Object> updates = new HashMap<String, Object>(); updates.put("g", geoHash.getGeoHashString()); updates.put("l", Arrays.asList(location.getLatitude(), location.getLongitude())); FirebaseDatabase.getInstance().getReference() .child("group_locations") .child(group_id) .child(uid) .setValue(updates); EventBus.getDefault().post(location); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_purchase_history); // Firebase Setting mAuth = FirebaseAuth.getInstance(); user = mAuth.getCurrentUser(); firestore = FirebaseFirestore.getInstance(); userId = user.getUid(); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); coverLL = (LinearLayout) findViewById(R.id.myProductLL); setImageView(); }
@Before public void initValideString(){ displayName = "Musa"; fullName = "MusaRikhotso"; FirebaseApp.initializeApp(rule.getActivity()); mAuth = FirebaseAuth.getInstance(); mAuth.signInWithEmailAndPassword("testgmail.com", "password") .addOnCompleteListener(rule.getActivity(), new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information } else { // If sign in fails, display a message to the user. Log.w("login activity", "signInWithEmail:failure", task.getException()); } } }); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { binding = DataBindingUtil.inflate(inflater, R.layout.dialog_rating, container, false); binding.setHandler((cancel, rate, text) -> { if (! cancel) { final Rating rating = new Rating(FirebaseAuth.getInstance().getCurrentUser(), rate, text.toString()); if (mRatingListener != null) { mRatingListener.onRating(rating); } } dismiss(); }); return binding.getRoot(); }
private void showWhiteSnackBar(int signed_in_message) { LayoutInflater inflater = getLayoutInflater(); FirebaseAuth auth = FirebaseAuth.getInstance(); String userId; View layout = inflater.inflate(R.layout.custom_toast_view, (ViewGroup) findViewById(R.id.custom_toast_container)); TextView text = (TextView) layout.findViewById(R.id.text); if (null != auth.getCurrentUser()) { userId = auth.getCurrentUser().getDisplayName(); String strMeatFormat = getResources().getString(R.string.welcome_format); String strMeatMsg = String.format(strMeatFormat, userId); text.setText(strMeatMsg); } else { text.setText(signed_in_message); } Toast toast = new Toast(getApplicationContext()); toast.setDuration(Toast.LENGTH_SHORT); toast.setView(layout); toast.show(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sales_history); // Firebase Setting mAuth = FirebaseAuth.getInstance(); user = mAuth.getCurrentUser(); firestore = FirebaseFirestore.getInstance(); userId = user.getUid(); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); coverLL = (LinearLayout) findViewById(R.id.myProductLL); setImageView(); }
@Inject MainViewModel(MainRepository repository) { this.repository = repository; filters.setValue(Filters.getDefault()); isSignedIn = new LiveData<Boolean>() { @Override protected void onActive() { super.onActive(); setValue(FirebaseAuth.getInstance().getCurrentUser() != null); } }; restaurants = Transformations.switchMap(filters, repository::restaurants); }
public String getAuthUserEmail() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); String email = null; if (user != null) { email = user.getEmail(); } return email; }
protected void configGoogleSignIn() { GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mGoogleSignInClient = GoogleSignIn.getClient(this, gso); mAuth = FirebaseAuth.getInstance(); }