Build an Android Application with Authentication

Build an Android Application with Authentication

Tutorial: Build a simple Android application with authentication then add social and biometric authentication.

prathap badavath

after clicking sign in button okta login web page not opening.

Matt Raible

Did you give your app permission to use the internet?

prathap badavath

yes, i gave permission in Manifest file.

Brian Demers

Hey Prathap!
What do you see when it’s not opening? any errors in your logs/console?
Are you running in an emulator or on device?

prathap badavath

running on device.

Brian Demers

What happens when you click on the button? Are there any errors in the log/console?

Jason Celestine

We have customers that have their own okta subscriptions. How would I include okta login support that allows them to dynamically pick what subscription they want to auth against? Is the expectation that each customer would require a custom build?

Matt Raible

Hello Jason,

The only solution I can think of is to have some sort of endpoint that returns the Okta configuration information for each customer. I don’t think our Android SDK has dynamic configuration built in, but I’m sure it’s possible to add. You could try opening an issue in our Android SDK with this as a feature request.

Jason Celestine

Thanks Matt, that’s basically what I was thinking. I was hoping Okta would have an option simular to the MS Azure AD feature that can auth with any MS account.

Matt Raible

I had the same issue. Add .setRequireHardwareBackedKeyStore(false) to your WebAuthBuilder to fix it so it’ll run in an emulator.

Rob de Kluijver

There are warnings building the example.
jcenter repository end-of-service - replacing it with mavenCentral was no solution.
kotlin-android-extensions plugin deprecated - I can migrate but better adapt the example.

Matt Raible

If you’d like to create a pull request to the example repo, I’d be happy to send you a t-shirt! :slight_smile:

Nathan DeGroff

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.

Matt Raible

Hello Nathan,

I noticed you posted this same question to our developer forums. I’m just providing the link here so others can find it. In the future, please don’t cross post. We get notifications for both the blog and our forums and it just creates more work to answer your question in two places.

Nathan DeGroff

Thanks Matt, my apologies. I posted to this blog as the topic was the most similar one I found and I wanted to cast my net wide enough.