# Invalid authentication token

**URL:** <https://forum.social.plus/t/invalid-authentication-token/831>\
**Category:** Android\
**Created:** [July 21, 2023, 10:48am UTC](https://forum.social.plus/t/invalid-authentication-token/831 "2023-07-21T10:48:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ups1995](https://avatars.discourse-cdn.com/v4/letter/u/bbe5ce/32.png) [@ups1995](https://forum.social.plus/u/ups1995)\
**Post date:** [July 21, 2023, 10:48am UTC](https://forum.social.plus/t/invalid-authentication-token/831/1 "2023-07-21T10:48:10Z")

</div>

Hello Team,  
It will display **Invalid authentication token (0).** when i call following code

```auto
AmityCoreClient.setup(
            apiKey = BuildConfig.AMITY_API_KEY,
            endpoint = AmityEndpoint.SG,
        ).subscribe()

```

```auto
 private fun registerDevice(userId: String, displayName: String? = "") {
        AmityCoreClient.login(userId, object : SessionHandler {
            override fun sessionWillRenewAccessToken(renewal: AccessTokenRenewal) {
                renewal.renew()

            }
        })
            .apply {
                if (!displayName.isNullOrEmpty()) {
                    displayName(displayName)
                }
            }
            .build()
            .submit()
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .doOnComplete {
                registerForPushNotifications()
                val intent = Intent(this, AmitySettingActivity::class.java)
                startActivity(intent)
            }
            .doOnError {
                findViewById<View>(android.R.id.content).showSnackBar("Could not register user " + it.message)
            }
            .untilLifecycleEnd(this)
            .subscribe()
    }

```

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [July 24, 2023, 9:24am UTC](https://forum.social.plus/t/invalid-authentication-token/831/2 "2023-07-24T09:24:12Z")

</div>

Hi @ups1995 ,

May I know if you’re using our OpenSource Android UIKit?

Thank you,  
Amity Support
