NowSDKAuthorizationProviding interface - Android
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.
| 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. |
| 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)
}
}