auth0 / auth0-flutter

Auth0 SDK for Flutter
https://pub.dev/documentation/auth0_flutter/latest/
Apache License 2.0
57 stars 36 forks source link

Getting Java ClassCastException for Android clients #410

Open p-salmon opened 4 months ago

p-salmon commented 4 months ago

Checklist

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

Widcket commented 4 months ago

Hi @p-salmon, thanks for raising this.

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