accessTokenInterceptor

fun accessTokenInterceptor(): Interceptor

Returns an Interceptor that can be can be added to an OkHttpClient via OkHttpClient.Builder.addInterceptor to access a Resource Server.

The Interceptor attaches an authorization: Bearer header with the access token to all requests. Internally, this uses Credential.getValidAccessToken to automatically refresh the access token once it expires. If no valid access token is available, no authorization header will be added, and a NoAccessTokenAvailableEvent event will be emitted to the associated EventCoordinator.