I have checked the documentation however, I do not understand where the link is to connect the accounts. I have a Google login working and a Password/Email version working seperately, however they do not yet work together on the same account. For example I want to allow a user to log into his account with his google account or his username and password - both using the same credential token. I am using firebase as the backend. I was hoping someone knew of a good example i could follow or if someone knew the code i needed to make the connection and where to place it on a standard log in application on Android, Many thanks !!
Asked
Active
Viewed 859 times
2 Answers
0
I think the official documentation you're looking for is under the heading "Link Multiple Auth Providers".

Doug Stevenson
- 297,357
- 32
- 422
- 441
-
I did read through that documentation, however, it was very vague and gave no indication as to where the connection code should be placed. It says not to implement the signinwithPasaword step and instead add another method, but it never says where to implement with in code, I was more looking to see if anyone had an example of linking all these code examples together. Thanks ! – FeedMeData Feb 10 '17 at 12:25
0
All you need to do is the following:
AuthCredential credential = GoogleAuthProvider.getCredential(googleIdToken, null);
mAuth.getCurrentUser().linkWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
task.isSuccessful());
if (!task.isSuccessful()) {
Toast.makeText(AnonymousAuthActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
});

Michele La Ferla
- 6,775
- 11
- 53
- 79