Tokens

A central component of the SDK is managing authorization and authentication tokens for several use cases.

fetch_token_by_type

Allows to fetch a specific type of token, providing search parameters to further classify which token to return (e.g. the subscription id for a Subscription Receipt Token).

The result is a TokenSearchResult or an error if the token could not be fetched.

let search_options = TokenSearchOptions(
    subscriptionId: "1", 
    ipAddress: nil,
    endpointConfiguration: nil,  
    forceRefresh: false);
let result = kapeSdkManger.tokens().fetchTokenByType(
    tokenType: TokenNames.subscriptionReceiptToken, 
    advancedSearchOptions: search_options)
Parameter
Type
Description

token_type

TokenName

Type of the token to fetch

advanced_search_option

TokenSearchOptions optional

Depending on the type of tokens, this parameter is required and will contain additional options to search for the desired token

enumerate_tokens

Enumerates all tokens in the cache and returns an array of TokenSearchResult.

This method does not refresh tokens automatically or fetches missing tokens. It only returns the items in the cache.

TokenSearchResult

Parameter
Type
Description

subscription_id

String optional

The subscription id, this token belongs to

raw_token_data

String

The raw token data (usually JWT format)

token_meta_data

TokenMetaData optional

Optional additional meta-information about that token

token_name

TokenName

The type of token, see list below

See the different token types to learn more about the available options:

SubscriptionReceiptToken

ConnectionAuthorizationToken

WireGuardToken

OpenIdAccessToken

OpenIdRefreshToken

Last updated