---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# AuthorizationToken class - Android

# AuthorizationToken class - Android {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The AuthorizationToken class provides the authorization token
provided by the host application. Used by the NowSDK to authorize access to a specified ServiceNow instance for the currently logged in user.
{#AuthorizationTokenAndroidAPI__table_vx2_klw_5pb__entry__3}

| Name | Type | Description |
|-|-|-|
| token | String | Value of the authorization token. |
| type | String | Type of authorization token. Valid values (case-sensitive): * JWT * OAuthAccess * OAuthRefresh {#AuthorizationTokenAndroidAPI__ul_fcw_mrx_nqb} |
[Table 1. Properties]

{#AuthorizationTokenAndroidAPI__table_vx2_klw_5pb}

## AuthorizatonToken - AuthorizationToken(type: AuthorizationTokenType, token: String) {#ariaid-title2}

Returns the authorization token provided by the host application.
{#AuthToken-AuthorizationToken_S_S__table_orr_1gn_cqb__entry__3}

| Name | Type | Description |
|-|-|-|
| type | String | Type of authorization token. Valid values (case-sensitive): * JWT * OAuthAccess * OAuthRefresh {#AuthToken-AuthorizationToken_S_S__ul_fcw_mrx_nqb} |
| token | String | Value of the authorization token. |
[Table 2. Parameters]

{#AuthToken-AuthorizationToken_S_S__table_orr_1gn_cqb} {#AuthToken-AuthorizationToken_S_S__table_prr_1gn_cqb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 3. Returns]

{#AuthToken-AuthorizationToken_S_S__table_prr_1gn_cqb}  
<br />

    class SDKManager @Inject constructor(
      private val settings: Provider<NowSDKSettings>,
      private val jwtService: JWTService
    ) : NowSDKAuthorizationProviding,
      DevicePermissionDelegate {

      override fun requestAuthorization(
        instanceURL: URL,
        callback: Consumer<List<AuthorizationToken>?>
      ) {
          GlobalScope.launch(Dispatchers.IO) {
            try {
              val token = jwtService.getJWT(settings.get().user, settings.get().clientId).token
              callback.accept(
                listOf(
                  AuthorizationToken(
                    AuthorizationTokenType.JWT,
                    token
                  )
                )
              )
            } catch (ex : Exception) {
               Log.e("JWT", "Failed to get jwt", ex)
               return@launch callback.accept(null)
            }
          }
        }


