I have implemented passworldless authentication (mobile no + OTP) in android app. I am able to successfully authenticate the user.
Now trying to include firebase as a backend. For this AuthenticationAPIClient is requesting credentials through delegation API
String apiType = "firebase";
final String tokenId = payload.getIdToken();
apiClient.delegationWithIdToken(tokenId, apiType)
.start(new BaseCallback<Map<String, Object>, AuthenticationException>() {
@Override
public void onSuccess(Map<String, Object> payload) {
mAuth.signInWithCustomToken(payload.get("idToken").toString()).
addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Log.d(TAG, "signnwithCustom:success");
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
launchHomeOrWelcomePage();
} else {
//if sign in fails
Log.w(TAG, "sign in with custom token failed");
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
if (e instanceof FirebaseAuthException) {
Log.w(TAG, "" + ((FirebaseAuthException) e).getErrorCode());
}
}
});
}
@Override
public void onFailure(AuthenticationException error) {
Log.e(TAG, "authentication exception error" +
error.getMessage(), error);
}
});
}
});
}
};
But the problem is following error is popping out in onFailure(AuthenticationException error)` function
authentication exception errorAn error occurred when trying to authenticate with the server.
com.auth0.android.authentication.AuthenticationException: An error occurred when trying to authenticate with the server.
at com.auth0.android.request.internal.AuthenticationErrorBuilder.from(AuthenticationErrorBuilder.java:28)
at com.auth0.android.request.internal.AuthenticationErrorBuilder.from(AuthenticationErrorBuilder.java:9)
at com.auth0.android.request.internal.BaseRequest.parseUnsuccessfulResponse(BaseRequest.java:135)
at com.auth0.android.request.internal.SimpleRequest.onResponse(SimpleRequest.java:65)
at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:177)
at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
I have enabled firebase as a add on in project and made all the necessary changes under settings tab
of firebase add-on API. Any help is appreciated in resolving this issue.
I simply picking id_token form debugger not even going to far with writing the complete code for making a request and passing it to the curl suggested by Auth0 docs. Nothing works.
I have this error:
{“error”:“invalid_token”,“error_description”:“Not enough or too many segments”,“statusCode”:401}
I don’t want to give up on Auth0 and go straight to Firebase which also has auth. I have lost 3 hours trying to solve that. If it’s late to help me - someone else could receive your help
Well I will suggest you to move on to firebase auth because auth0 support is really bad. I have raised this problem with 4-5 engineers of auth0 but no one replied. This product is good but the biggest problem is support and this is the not the first time I am facing this issue with auth0 support.
Even I am planning to move to firebase auth(mobile no + SMS code).