AuthModule

public class AuthModule : TokenRefreshing

Provides Token management.

  • Refresh the given token.

    Declaration

    Swift

    public func refresh(refreshToken: String, completion: @escaping TokenInfoClosure)

    Parameters

    refreshToken

    The token to refresh.

    completion

    Returns the token data or an error.

  • Exchange an authorization code for an access token

    Declaration

    Swift

    public func getToken(withCode code: String, completion: @escaping TokenInfoClosure)

    Parameters

    code

    Authorization code

    completion

    Returns the token data or an error.

  • Revokes an access or refresh token, rendering it invalid.

    Declaration

    Swift

    public func revokeToken(token: String, completion: @escaping Callback<Void>)

    Parameters

    token

    The token to revoke.

    completion

    Called after the revocation completes

  • Downscope the token.

    Declaration

    Swift

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

    Parameters

    parentToken

    Fully-scoped access token. This can be an OAuth (Managed User), JWT (App User or Service Account) or an App Token (New Box View) token.

    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 token data or an error.