Support for Android Jetpack Compose (Kotlin)

Platform: Android
Framework: Jetpack Compose

I’ve been able to get the android (Java and Kotlin) GitHub web client sample apps to work using my developer account and with the new corporate account created. However, our team has decided to start development of a new Android app using Jetpack Compose (a declarative UI).

I’ve been having difficulty trying to port that sample kotlin code over to work with the new framework. I’m able to kick off the Okta Web Client and authenticate in, but when passing control back, the registered result callback does nothing and the client is in permanent limbo.

Is there any samples of Okta with Compose? The Github samples have been very useful so far.

Thanks in advance.

Hello, sorry to say but we do not have any samples for Jetpack Compose =(. AFAIK we don’t have any material for this either - walkthroughs or blog posts.

Thanks Cale. I was afraid as much. I’d rather not roll my own authentication handshaking with Okta, but I might not have any other choice… Looks like something is wonky on the hand back from the WebAuth Client.

I’m able to kick off the Web Auth client and log in successfully, but it never sets the session as authenticated or triggers the registered RequestCallback.

Same emulator / web client / SDK works when using an older Android Kotlin app…

I am having the same issue - were you able to get it to work using the WebAuth Client or did you have to roll your own?

We ended up using the Okta OIDC and Authn SDK API libraries and writing our own custom screens.

It was fortunate because the product owners and SME didn’t like the app opening a browser and then coming back to the app. Writing our own custom login screens with the same design/color scheme as the rest of the app worked well.

These are the libraries we used with Kotlin. I think now they have newer updated libraries for OIE integration, but we had to go live before they were in place.

    //------------------------------------------------
    // Okta Libraries
    implementation 'com.okta.android:oidc-androidx:1.0.16'
    implementation 'com.okta.authn.sdk:okta-authn-sdk-api:2.0.0'
    implementation('com.okta.authn.sdk:okta-authn-sdk-impl:2.0.0') {
        exclude group: 'com.okta.sdk', module: 'okta-sdk-httpclient'
    }
    implementation 'com.okta.sdk:okta-sdk-okhttp:2.0.0'
    implementation 'com.squareup.okhttp3:okhttp:4.9.0'
1 Like

Shifting our main activity from ComponentActivity to AppCompatActivity allowed the callback to fire as expected.