Skip to content

AuthorizationEvent

classAuthorizationEvent

Authorization token refresh result delivered to BGGeo.onAuthorization.

The SDK fires this event after each token refresh attempt triggered by AuthorizationConfig.refreshUrl. Use it to update your app's local credential store, handle refresh failures, or react to expired sessions.

val bgGeo = BGGeo.instance
bgGeo.onAuthorization { event ->
    if (event.isSuccess) {
        Log.d(TAG, "[onAuthorization] Token refreshed: ${event.response}")
        // Update your app's stored token.
        val token = (event.response as? Map<*, *>)?.get("access_token")
    } else {
        Log.w(TAG, "[onAuthorization] Refresh failed: ${event.error}")
    }
}

Members

error

val error: String?

Error message when success is false; null otherwise.

isSuccess

val isSuccess: Boolean

true when the token refresh request returned a 2xx status code.

response

val response: Map<String, Any>?

Decoded JSON body returned by the refresh server when success is true; null otherwise.

statusCode

val statusCode: Int

HTTP status code returned by AuthorizationConfig.refreshUrl, or 0 if the request failed before reaching the server.