Search Results for

    Show / Hide Table of Contents

    Class ColizeumToken

    A class which holds currently active tokens and manages token encryption in PlayerPrefs

    Inheritance
    Object
    ColizeumToken
    Namespace: ColizeumSDK.Auth
    Assembly: cs.temp.dll.dll
    Syntax
    public class ColizeumToken : MonoBehaviour

    Fields

    OnInvalid

    An event which is called when the SDK fails to get a new access token, which usually means that the refresh token has expired

    Declaration
    public Action OnInvalid
    Field Value
    Type Description
    Action

    Properties

    AccessToken

    Access Token which is used to access data on behalf of the Colizeum user

    Declaration
    public string AccessToken { get; }
    Property Value
    Type Description
    String

    AccessTokenExpiresAt

    UNIX timestamp which represents when the access token will be invalid

    Declaration
    public int AccessTokenExpiresAt { get; }
    Property Value
    Type Description
    Int32

    IDToken

    ID Token that proves that the Colizeum user has been authenticated

    Declaration
    public string IDToken { get; }
    Property Value
    Type Description
    String

    RefreshToken

    Refresh Token which is used to get a new Access Token

    Declaration
    public string RefreshToken { get; }
    Property Value
    Type Description
    String

    RefreshTokenExpiresAt

    UNIX timestamp which represents when the refresh token will be invalid

    Declaration
    public int RefreshTokenExpiresAt { get; }
    Property Value
    Type Description
    Int32

    Methods

    CanBeRefreshed()

    Returns a boolean indicating if the access token can be refreshed (assuming it's not revoked server-side)

    Declaration
    public bool CanBeRefreshed()
    Returns
    Type Description
    Boolean

    Create(String, String, String, Int32)

    Creates a new token instance and stores encrypted data

    Declaration
    public void Create(string accessToken, string refreshToken, string idToken, int expiresIn)
    Parameters
    Type Name Description
    String accessToken
    String refreshToken
    String idToken
    Int32 expiresIn

    Destroy()

    Destroys the current token instance and also clears the store data

    Declaration
    public void Destroy()

    Exists()

    Returns a boolean indicating if the access token exists

    Declaration
    public bool Exists()
    Returns
    Type Description
    Boolean

    Boolean

    IsValid()

    Returns a boolean indicating if the access token exists and it's valid

    Declaration
    public bool IsValid()
    Returns
    Type Description
    Boolean

    Boolean

    Refresh(Action, Action<Exception>)

    Tries to refresh the current access token using the stored refresh token

    Declaration
    public void Refresh(Action onSuccess, Action<Exception> onError)
    Parameters
    Type Name Description
    Action onSuccess
    Action<Exception> onError
    In This Article
    Back to top Colizeum Unity SDK API Reference