auth0-flutter icon indicating copy to clipboard operation
auth0-flutter copied to clipboard

Getting Java ClassCastException for Android clients

Open p-salmon opened this issue 1 year ago • 1 comments

Checklist

  • [X] The issue can be reproduced in the auth0_flutter sample app (or N/A).
  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Description

Hi everyone, thank you for the awesome project.

We are getting a singular error in our logs, here is a condensed trace:

Fatal Exception: java.lang.ClassCastException
fc.h cannot be cast to java.lang.String
  com.auth0.auth0_flutter.UserProfileExtensionsKt.getLocale (UserProfileExtensions.kt:57)
  com.auth0.auth0_flutter.UserProfileExtensionsKt.toMap (UserProfileExtensions.kt:23)
  com.auth0.auth0_flutter.request_handlers.web_auth.LoginWebAuthRequestHandler$handle$1.onSuccess (LoginWebAuthRequestHandler.kt:82)
  com.auth0.auth0_flutter.request_handlers.web_auth.LoginWebAuthRequestHandler$handle$1.onSuccess (LoginWebAuthRequestHandler.kt:64)
  com.auth0.android.provider.OAuthManager$resume$1$onSuccess$1.onSuccess (OAuthManager.kt:111)
  com.auth0.android.provider.OAuthManager$resume$1$onSuccess$1.onSuccess (OAuthManager.kt:109)
  com.auth0.android.provider.OAuthManager$assertValidIdToken$signatureVerifierCallback$1.onSuccess (OAuthManager.kt:179)
  com.auth0.android.provider.OAuthManager$assertValidIdToken$signatureVerifierCallback$1.onSuccess (OAuthManager.kt:157)
  com.auth0.android.provider.SignatureVerifier$1.onSuccess (SignatureVerifier.java:61)
  com.auth0.android.provider.SignatureVerifier$1.onSuccess (SignatureVerifier.java:56)
  com.auth0.android.request.internal.BaseRequest.start$lambda$2$lambda$0 (BaseRequest.kt:74)
  android.os.Handler.handleCallback (Handler.java:958)

This is coming from a single client: Brand: Samsung Model: Galaxy S22 Version: Android 14

When we look into the code, we can see this issue is coming from user profile extraction:

val UserProfile.locale: String?
    get() = getExtraInfo()["locale"] as String?

We're a little bit clueless on how to approach this bug resolution, and where hoping to find any ideas on how to solve this, just clues on how to solve this could be greatly appreciated, thanks.

Reproduction

We couldn't manage to reproduce the error, unfortunately.

Additional context

No response

auth0_flutter version

1.3.1

Flutter version

3.16.5

Platform

Android

Platform version(s)

14

p-salmon avatar Feb 19 '24 11:02 p-salmon

Hi @p-salmon, thanks for raising this.

What is the value that comes in the "locale" claim?

Widcket avatar Mar 04 '24 17:03 Widcket