Auth0.Android: AuthenticationException constructor throws ClassCastException
This is the latest build I believe (v1.3.0).
When I allow the Auth0 validation to occur instead of my own, (specifically for passwords) I get an exception that I cannot handle without overriding that class. This seems like it shouldn’t be happening, so let me know if it looks suspicious, however, I am seeing this issue on 1.0.0 as well as 1.3.0
Judging by where I get to whilst debugging, it looks like the offending line is (AuthenticationException 74):
this.description = (String) (this.values.containsKey(DESCRIPTION_KEY) ? this.values.get(DESCRIPTION_KEY) : this.values.get(ERROR_DESCRIPTION_KEY));
here is the stack trace:
java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to java.lang.String at com.auth0.android.request.internal.AuthenticationErrorBuilder.from(AuthenticationErrorBuilder.java:23) at com.auth0.android.request.internal.AuthenticationErrorBuilder.from(AuthenticationErrorBuilder.java:9) at com.auth0.android.request.internal.BaseRequest.parseUnsuccessfulResponse(BaseRequest.java:133) 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)
here’s what’s inside the values object:
values = {LinkedTreeMap@7884} size = 6
0 = {LinkedTreeMap$Node@7909} "name" -> "PasswordStrengthError"
1 = {LinkedTreeMap$Node@7910} "message" -> "Password is too weak"
2 = {LinkedTreeMap$Node@7911} "code" -> "invalid_password"
3 = {LinkedTreeMap$Node@7912} "description" -> " size = 2"
4 = {LinkedTreeMap$Node@7913} "policy" -> "* At least 6 characters in length"
5 = {LinkedTreeMap$Node@7914} "statusCode" -> "400.0"
Let me know if I can provide any more information or be any more help
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (8 by maintainers)
@lbalmaceda
Thank you very much for your kind detailed clarification, professional support and patience.
Your support is helpful and appreciated.
We would follow your guidelines.
Thanks Ofer
This will be available in the next release. 👍