# Can we login our Android Kotlin app by serial number?

**URL:** <https://community.auth0.com/t/can-we-login-our-android-kotlin-app-by-serial-number/184370>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [March 24, 2025, 4:31pm UTC](https://community.auth0.com/t/can-we-login-our-android-kotlin-app-by-serial-number/184370 "2025-03-24T16:31:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![flip](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@flip](https://community.auth0.com/u/flip)\
**Post date:** [March 24, 2025, 4:31pm UTC](https://community.auth0.com/t/can-we-login-our-android-kotlin-app-by-serial-number/184370/1 "2025-03-24T16:31:09Z")

</div>

Hi, We now authenticate our devices by scanning a QR code and let user login. See this flow:

> **[Auth0 Device Authorization Flow SDK Quickstarts: Device Authorization Flow](https://auth0.com/docs/quickstart/native/device/interactive)**
>
> This tutorial demonstrates how to call your API from an input-constrained device using the Device Authorization Flow.

But we have some IoT unique devices without screen. So we like to auto login them with their serial numbers? Is their some documentation how to do that?

If we can for example hardcode the username and password securely in the code. (something like this):

```auto
authentication
    .login("companyId@placeholder-email.com", "serial number")
    .setScope("openid email profile offline_access")
    .start(object : Callback<Credentials, AuthenticationException> {
        override fun onFailure(exception: AuthenticationException) {
            // Error
        }

        override fun onSuccess(credentials: Credentials) {
            //Save the credentials
            manager.saveCredentials(credentials)
        }
    })

```

We can easy create a user with:

- User: [companyId@placeholder-email.com](mailto:companyId@placeholder-email.com)]
- Pass: serial number

Trough our backend. Then if we provision a device, we can set create this user, with linked serialnumber to auto login.

If we need to remove access, we can easy remove the user from Auth0.

Hope their are some tips how to handle this. Since in all documentation I only see options with the Auth0 login form to login.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [March 24, 2025, 7:12pm UTC](https://community.auth0.com/t/can-we-login-our-android-kotlin-app-by-serial-number/184370/3 "2025-03-24T19:12:54Z")

</div>

Hi @flip,

Thanks for your question.

I don’t believe there is any way to log in to your app using only the serial number.  
As an alternative option, you could try logging the user in with their email/password using the [password grant flow.](https://auth0.com/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow/call-your-api-using-resource-owner-password-flow)

In the Auth0 Android SDK, there is a the `login()` function that allows you to accomplish this:

```auto
fun login(
    usernameOrEmail: String, 
    password: String
): AuthenticationRequest

```

(Reference: [index for package auth0.com.auth0.android.authentication.-authentication-a-p-i-client - auth0 3.5.0 javadoc](https://javadoc.io/doc/com.auth0.android/auth0/latest/auth0/com.auth0.android.authentication/-authentication-a-p-i-client/index.html))

Let me know if you have any follow-up questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [April 7, 2025, 7:13pm UTC](https://community.auth0.com/t/can-we-login-our-android-kotlin-app-by-serial-number/184370/4 "2025-04-07T19:13:06Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
