CCGAuthSession

public class CCGAuthSession : SessionProtocol, ExpiredTokenHandling

An authorization session using Client Credentials Grant

  • Revokes token

    Declaration

    Swift

    public func revokeTokens(completion: @escaping Callback<Void>)

    Parameters

    completion

    Returns empty result in case of success and an error otherwise.

  • Retrieves valid access token

    Declaration

    Swift

    public func getAccessToken(completion: @escaping AccessTokenClosure)

    Parameters

    completion

    AccessTokenClosure returning either valid access token string or an error.

  • Handles token expiration.

    Declaration

    Swift

    public func handleExpiredToken(completion: @escaping Callback<Void>)

    Parameters

    completion

    Returns either empty result representing success or error.

  • Downscope the token.

    Declaration

    Swift

    public func downscopeToken(
        scope: Set<TokenScope>,
        resource: String? = nil,
        sharedLink: String? = nil,
        completion: @escaping TokenInfoClosure
    )

    Parameters

    scope

    Scope or scopes that you want to apply to the resulting token.

    resource

    Full url path to the file that the token should be generated for, eg: https://api.box.com/2.0/files/{file_id}

    sharedLink

    Shared link to get a token for.

    completion

    Returns the success or an error.