Fellows I am struggling to get OpenID Connect auth...
# multiplatform
j
Fellows I am struggling to get OpenID Connect authentication to work on a KMP app for ios and android. I am using auth0 as provider. I managed to add authentication to android only. When implementing for iOS, I found instructions on how to do it on a swift project. However, I have not figured out so far how to do the process on KMM for ios. I hit the wall when trying to figure out how to add ios dependencies for the project. I am in between: • a) finding a multiplatform solution that solves authentication with OpenID Connect • b) figuring out how to add ios dependencies Any suggestion?
i'm thinking in going with b), but i thought about asking, in case someone has a sample multiplataform app that authenticates with auth0 😅
This tutorial from ktor client almost do what I wanted https://github.com/ktorio/ktor-documentation/blob/2.3.8/codeSnippets/snippets/client-auth-oauth-google/src/main/kotlin/com/example/Application.kt However i need a client side solution. Login would be first triggered by a button press. And in need the "app route" (app link on Android, and its equivalent on ios) to capture the response from auth0 (app -> browser -> back to app).
p
You have a couple of options. Open a ticket in Auth0 asking for KMP support. If they only provide swift support and not objective-c. I think the shortest path would be to do expect/actual. Define abstract classes and interfaces in commonMain/iosMain, export the interfaces to swift App, implement the swift adapters, then inject the implementations to your KMP library that depends on the abstractions.
d
Not sure if its still relevant, but I was trying the same. As far as I'm aware, using Swift only libraries is not possible and unfortunately the Auth0 SDK is fully made in Swift. You can however use this library which is working well for me: https://github.com/kalinjul/kotlin-multiplatform-oidc
j
Thanks for the link!
Will check
1