NowSDKAuthorizationProviding interface - Android

  • Release version: Zurich
  • Updated July 31, 2025
  • 1 minute to read
  • The NowSDKAuthorizationProviding interface provides a function that configures the link to the ServiceNow instance for which authorization is needed and any associated callbacks.

    NowSDKAuthorizationProviding - requestAuthorization(instanceURL: URL, callback: Consumer<List<AuthorizationToken>?>)

    Authorizes the currently logged-in user on the specified ServiceNow instance using the specified AuthorizationToken objects.

    Table 1. Parameters
    Name Type Description
    instanceURL URL ServiceNow instance for which the authorization is being requested.
    callback Consumer​<List​<AuthorizationToken>?> Array of logged-in user specific Authorization Token objects.
    Table 2. Returns
    Type Description
    None

    class NowSDKAuthorizationManager: NowSDKAuthorizationProviding {
      override fun requestAuthorization(
        instanceURL: URL,
        callback: Consumer<List<AuthorizationToken>?>
      ){
        val token = JWTService.fetchJwt()
        val authorizationToken = AuthorizationToken(AuthorizationTokenType.JWT, token)
        val result = listOf(authorizationToken)
        callback.accept(result)
      }
    }