supabase-community / supabase-kt

A Kotlin Multiplatform Client for Supabase.
https://supabase.com/docs/reference/kotlin/introduction
MIT License
358 stars 35 forks source link

[Bug]: androidx.credentials.exceptions.NoCredentialException: No credentials available #659

Open Deorigami opened 1 month ago

Deorigami commented 1 month ago

General Info

Version(s)

2.5.2

Kotlin Target(s) and their respective versions

2.0.0

What happened? (include your code)

I upgraded the version to 2.5.2 because i want to use Google Sign In on iOS but after upgrade from 2.5.0 this error appear on Android

when execute composeAuth.rememberSignInWithGoogle().startFlow()

Credential exception androidx.credentials.exceptions.NoCredentialException: No credentials available at androidx.credentials.CredentialProviderFrameworkImpl.convertToJetpackGetException$credentials_release(CredentialProviderFrameworkImpl.kt:276) at androidx.credentials.CredentialProviderFrameworkImpl$onGetCredential$outcome$2.onError(CredentialProviderFrameworkImpl.kt:152) at androidx.credentials.CredentialProviderFrameworkImpl$onGetCredential$outcome$2.onError(CredentialProviderFrameworkImpl.kt:143) at android.credentials.CredentialManager$GetCredentialTransport.lambda$onError$2(CredentialManager.java:694) at android.credentials.CredentialManager$GetCredentialTransport.$r8$lambda$nlbYav9mLBoE6Yh1vFKCvITF3ks(Unknown Source:0) at android.credentials.CredentialManager$GetCredentialTransport$$ExternalSyntheticLambda2.run(Unknown Source:6) at androidx.credentials.CredentialManager$$ExternalSyntheticLambda0.execute(Unknown Source:0) at android.credentials.CredentialManager$GetCredentialTransport.onError(CredentialManager.java:693) at android.credentials.IGetCredentialCallback$Stub.onTransact(IGetCredentialCallback.java:123) at android.os.Binder.execTransactInternal(Binder.java:1344) at android.os.Binder.execTransact(Binder.java:1275)

Steps To Reproduce (optional)

No response

Relevant log output (optional)

No response

jan-tennert commented 1 month ago

@Aaron246 This issue is probably caused by the Google Sign In change, any ideas?

Aaron246 commented 1 month ago

I don't think the change has anything to do with this.

@Deorigami can you please check all of these for your project:

  1. You have 2 credentials in google cloud console, one web application and one android. Screenshot 2024-07-15 000957
  2. You are using the client ID in web application (the first one in the above screenshot) for

install(ComposeAuth) { googleNativeLogin(serverClientId = "google-client-id") }

in your android project and in the supabase console here Screenshot 2024-07-15 001736

  1. The sha-1 certificate and package name in the android credential on the google cloud console (the second credential on google cloud console) is same as the app you are testing right now i.e. if you are testing on debug version or the release version make sure the respective sha-1 key is used in the google cloud console here : Screenshot 2024-07-15 002616

If all of these are correct, the issue seems to be with the new Credential Manager API which is being used in ComposeAuth.

Lot of people are facing issues with the API you can see here.

jan-tennert commented 1 month ago

I upgraded the version to 2.5.2 because i want to use Google Sign In on iOS but after upgrade from 2.5.0 this error appear on Android

Just to clarify @Deorigami, does 2.5.0 work?

Deorigami commented 1 month ago

@jan-tennert Yes 2.5.0 works well on android without this issue, i have to rollback to 2.5.0

jan-tennert commented 1 month ago

Hmm, just tried updating one of my old projects and it seems to work fine. Not sure what we can do on this issue other than referring to Google