kalinjul / kotlin-multiplatform-oidc

Kotlin Multiplatform OpenIDConnect implementation for Android/iOS
https://kalinjul.github.io/kotlin-multiplatform-oidc/
Apache License 2.0
51 stars 16 forks source link

Ktor 3.0.0 support #75

Closed yuvaraj119 closed 1 week ago

yuvaraj119 commented 1 month ago

Error 1 unable to use oidcBearer in install(Auth) config

Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun Auth. oidcBearer(tokenStore: TokenStore, refreshHandler: TokenRefreshHandler, client: OpenIdConnectClient, onRefreshFailed: suspend (Exception) → Unit = ...): Unit defined in org. publicvalue. multiplatform. oidc. ktor
public fun Auth. oidcBearer(tokenStore: TokenStore, refreshAndSaveTokens: suspend (String) → OauthTokens?, onRefreshFailed: suspend (Exception) → Unit): Unit defined in org. publicvalue. multiplatform. oidc. ktor

Error 2

java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/plugins/contentnegotiation/ContentNegotiation;
                                                                                                        at org.publicvalue.multiplatform.oidc.DefaultOpenIdConnectClient$Companion$DefaultHttpClient$2$1.invoke(DefaultOpenIdConnectClient.kt:65)
                                                                                                        at org.publicvalue.multiplatform.oidc.DefaultOpenIdConnectClient$Companion$DefaultHttpClient$2$1.invoke(DefaultOpenIdConnectClient.kt:64)
                                                                                                        at io.ktor.client.HttpClientKt.HttpClient(HttpClient.kt:42)
                                                                                                        at io.ktor.client.HttpClientJvmKt.HttpClient(HttpClientJvm.kt:23)
                                                                                                        at org.publicvalue.multiplatform.oidc.DefaultOpenIdConnectClient$Companion$DefaultHttpClient$2.invoke(DefaultOpenIdConnectClient.kt:64)
                                                                                                        at org.publicvalue.multiplatform.oidc.DefaultOpenIdConnectClient$Companion$DefaultHttpClient$2.invoke(DefaultOpenIdConnectClient.kt:63)
                                                                                                        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
                                                                                                        at org.publicvalue.multiplatform.oidc.DefaultOpenIdConnectClient$Companion.getDefaultHttpClient(DefaultOpenIdConnectClient.kt:63)
                                                                                                        at org.publicvalue.multiplatform.oidc.DefaultOpenIdConnectClient.<init>(DefaultOpenIdConnectClient.kt:58)
                                                                                                        at org.publicvalue.multiplatform.oidc.OpenIdConnectClientKt.OpenIdConnectClient(OpenIdConnectClient.kt:32)
realdadfish commented 1 month ago

FYI I stumbled upon the same issue, however, looking at the changelog of 3.0.0 there is no mention of binary breakage, so I created an upstream ticket to get this eventually fixed: https://youtrack.jetbrains.com/issue/KTOR-7579

kalinjul commented 1 month ago

I'm not sure if we can expect a major version bump to be binary compatible. If it's not and the issue is not resolved, i'm not yet sure how to proceed, as ktor is obviously an essential part of this library and I'm not going to maintain two different branches. I guess we will upgrade to ktor 3.0.0 and continue with that version in the future.

yuvaraj119 commented 1 month ago

@kalinjul @realdadfish There are minimal changes required looks like Auth im not able to extend anymore. Something like Auth.addBearear Here Auth is changed to AuthConfig. AuthConfig.addBearear we will have to use. Also some related to durations are changed. These are the changes which i faced for my internal NetworkClient. It is breaking changes not able to use until i made all the changes in my client after upgrade to 3.0.0.

kalinjul commented 3 weeks ago

Could you check 0.12.0-SNAPSHOT? To use a snapshot version, you must add maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") to your repositories. See available snapshots.

kalinjul commented 1 week ago

ktor 3 support is available in 0.12.0