firebase phone authentication when enter verification code before auto sign in i got error then it signs in...
![Multi tool use Multi tool use](http://sgv.ssvwv.com/sg/ssvwvcomimagb.png)
Multi tool use
up vote
0
down vote
favorite
it's my first time working with firebase phone authentication , but when the number is at the device which the app is in after code is sent if the user enter the code he gots error then the app login automatically after few seconds!
how can i fix this issue ?
private void signInWithPhoneAuthCredential(PhoneAuthCredential
credential) {
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, 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
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user =
task.getResult().getUser();
firebase_uid = user.getUid();
// [START_EXCLUDE]
//updateUI(STATE_SIGNIN_SUCCESS, user);
// [END_EXCLUDE]
} else {
// Sign in failed, display a message and update the UI
Log.w(TAG, "signInWithCredential:failure", task.getException());
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
// The verification code entered was invalid
// mVerificationField.setError("Invalid code.");
loadingIndicator.dismiss();
Toast.makeText(Sign_up.this, "كود التحقق الذي أدخلته غير صحيح", Toast.LENGTH_LONG).show();
// [END_EXCLUDE]
}else if(task.getException() instanceof FirebaseTooManyRequestsException)
{
Toast.makeText(Sign_up.this, "لقد قمت بمحاولة التحقق عدة مرات , حاول لاحقا", Toast.LENGTH_LONG).show();
}else
{
Toast.makeText(Sign_up.this, task.getException().getMessage(), Toast.LENGTH_LONG).show();
}
}
}
});
}
![](http://i.stack.imgur.com/tKsDb.png)
![](http://i.stack.imgur.com/5d55j.png)
add a comment |
up vote
0
down vote
favorite
it's my first time working with firebase phone authentication , but when the number is at the device which the app is in after code is sent if the user enter the code he gots error then the app login automatically after few seconds!
how can i fix this issue ?
private void signInWithPhoneAuthCredential(PhoneAuthCredential
credential) {
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, 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
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user =
task.getResult().getUser();
firebase_uid = user.getUid();
// [START_EXCLUDE]
//updateUI(STATE_SIGNIN_SUCCESS, user);
// [END_EXCLUDE]
} else {
// Sign in failed, display a message and update the UI
Log.w(TAG, "signInWithCredential:failure", task.getException());
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
// The verification code entered was invalid
// mVerificationField.setError("Invalid code.");
loadingIndicator.dismiss();
Toast.makeText(Sign_up.this, "كود التحقق الذي أدخلته غير صحيح", Toast.LENGTH_LONG).show();
// [END_EXCLUDE]
}else if(task.getException() instanceof FirebaseTooManyRequestsException)
{
Toast.makeText(Sign_up.this, "لقد قمت بمحاولة التحقق عدة مرات , حاول لاحقا", Toast.LENGTH_LONG).show();
}else
{
Toast.makeText(Sign_up.this, task.getException().getMessage(), Toast.LENGTH_LONG).show();
}
}
}
});
}
![](http://i.stack.imgur.com/tKsDb.png)
![](http://i.stack.imgur.com/5d55j.png)
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
it's my first time working with firebase phone authentication , but when the number is at the device which the app is in after code is sent if the user enter the code he gots error then the app login automatically after few seconds!
how can i fix this issue ?
private void signInWithPhoneAuthCredential(PhoneAuthCredential
credential) {
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, 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
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user =
task.getResult().getUser();
firebase_uid = user.getUid();
// [START_EXCLUDE]
//updateUI(STATE_SIGNIN_SUCCESS, user);
// [END_EXCLUDE]
} else {
// Sign in failed, display a message and update the UI
Log.w(TAG, "signInWithCredential:failure", task.getException());
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
// The verification code entered was invalid
// mVerificationField.setError("Invalid code.");
loadingIndicator.dismiss();
Toast.makeText(Sign_up.this, "كود التحقق الذي أدخلته غير صحيح", Toast.LENGTH_LONG).show();
// [END_EXCLUDE]
}else if(task.getException() instanceof FirebaseTooManyRequestsException)
{
Toast.makeText(Sign_up.this, "لقد قمت بمحاولة التحقق عدة مرات , حاول لاحقا", Toast.LENGTH_LONG).show();
}else
{
Toast.makeText(Sign_up.this, task.getException().getMessage(), Toast.LENGTH_LONG).show();
}
}
}
});
}
![](http://i.stack.imgur.com/tKsDb.png)
![](http://i.stack.imgur.com/5d55j.png)
it's my first time working with firebase phone authentication , but when the number is at the device which the app is in after code is sent if the user enter the code he gots error then the app login automatically after few seconds!
how can i fix this issue ?
private void signInWithPhoneAuthCredential(PhoneAuthCredential
credential) {
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, 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
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user =
task.getResult().getUser();
firebase_uid = user.getUid();
// [START_EXCLUDE]
//updateUI(STATE_SIGNIN_SUCCESS, user);
// [END_EXCLUDE]
} else {
// Sign in failed, display a message and update the UI
Log.w(TAG, "signInWithCredential:failure", task.getException());
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
// The verification code entered was invalid
// mVerificationField.setError("Invalid code.");
loadingIndicator.dismiss();
Toast.makeText(Sign_up.this, "كود التحقق الذي أدخلته غير صحيح", Toast.LENGTH_LONG).show();
// [END_EXCLUDE]
}else if(task.getException() instanceof FirebaseTooManyRequestsException)
{
Toast.makeText(Sign_up.this, "لقد قمت بمحاولة التحقق عدة مرات , حاول لاحقا", Toast.LENGTH_LONG).show();
}else
{
Toast.makeText(Sign_up.this, task.getException().getMessage(), Toast.LENGTH_LONG).show();
}
}
}
});
}
![](http://i.stack.imgur.com/tKsDb.png)
![](http://i.stack.imgur.com/5d55j.png)
![](http://i.stack.imgur.com/tKsDb.png)
![](http://i.stack.imgur.com/5d55j.png)
edited yesterday
![](https://i.stack.imgur.com/14YWL.jpg?s=32&g=1)
![](https://i.stack.imgur.com/14YWL.jpg?s=32&g=1)
PradyumanDixit
2,0631718
2,0631718
asked yesterday
Moshera
11
11
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53349121%2ffirebase-phone-authentication-when-enter-verification-code-before-auto-sign-in-i%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
iK3C 6Mp0 AUtLieA