Class AuthCallbacks

Creates Ably TokenRequest objects and obtains Ably Tokens from Ably to subsequently issue to less trusted clients.

Hierarchy

Constructors

Properties

clientId: string

A client ID, used for identifying this client when publishing messages or for presence purposes. The clientId can be any non-empty string, except it cannot contain a *. This option is primarily intended to be used in situations where the library is instantiated with a key. Note that a clientId may also be implicit in a token used to instantiate the library. An error is raised if a clientId specified here conflicts with the clientId implicit in the token. Find out more about identified clients.

Methods

  • Instructs the library to get a new token immediately. When using the realtime client, it upgrades the current realtime connection to use the new token, or if not connected, initiates a connection to Ably, once the new token has been obtained. Also stores any TokenParams and AuthOptions passed in as the new defaults, to be used for all subsequent implicit or explicit token requests. Any TokenParams and AuthOptions objects passed in entirely replace, as opposed to being merged with, the current client library saved values.

    Parameters

    Returns void

  • Instructs the library to get a new token immediately. When using the realtime client, it upgrades the current realtime connection to use the new token, or if not connected, initiates a connection to Ably, once the new token has been obtained. Also stores any TokenParams passed in as the new default, to be used for all subsequent implicit or explicit token requests. Any TokenParams object passed in entirely replaces, as opposed to being merged with, the current client library saved value.

    Parameters

    Returns void

  • Instructs the library to get a new token immediately. When using the realtime client, it upgrades the current realtime connection to use the new token, or if not connected, initiates a connection to Ably, once the new token has been obtained.

    Parameters

    • Optional callback: tokenDetailsCallback

      A function which, upon success, will be called with a TokenDetails object. Upon failure, the function will be called with information about the error.

    Returns void

  • Creates and signs an Ably TokenRequest based on the specified (or if none specified, the client library stored) TokenParams and AuthOptions. Note this can only be used when the API key value is available locally. Otherwise, the Ably TokenRequest must be obtained from the key owner. Use this to generate an Ably TokenRequest in order to implement an Ably Token request callback for use by other clients. Both TokenParams and AuthOptions are optional. When omitted or null, the default token parameters and authentication options for the client library are used, as specified in the ClientOptions when the client library was instantiated, or later updated with an explicit authorize request. Values passed in are used instead of, rather than being merged with, the default values. To understand why an Ably TokenRequest may be issued to clients in favor of a token, see Token Authentication explained.

    Parameters

    Returns void

  • Creates and signs an Ably TokenRequest based on the specified (or if none specified, the client library stored) TokenParams. Note this can only be used when the API key value is available locally. Otherwise, the Ably TokenParams must be obtained from the key owner. Use this to generate an Ably TokenRequest in order to implement an Ably Token request callback for use by other clients. When the TokenRequest is omitted or null, the default token parameters for the client library are used, as specified in the ClientOptions when the client library was instantiated, or later updated with an explicit authorize request. Values passed in are used instead of, rather than being merged with, the default values. To understand why an Ably TokenRequest may be issued to clients in favor of a token, see Token Authentication explained.

    Parameters

    Returns void

  • Creates and signs an Ably TokenRequest based on the the client library stored TokenParams and AuthOptions. Note this can only be used when the API key value is available locally. Otherwise, the Ably TokenRequest must be obtained from the key owner. Use this to generate an Ably TokenRequest in order to implement an Ably Token request callback for use by other clients. The default token parameters and authentication options for the client library are used, as specified in the ClientOptions when the client library was instantiated, or later updated with an explicit authorize request. To understand why an Ably TokenRequest may be issued to clients in favor of a token, see Token Authentication explained.

    Parameters

    • Optional callback: tokenRequestCallback

      A function which, upon success, will be called with a TokenRequest object. Upon failure, the function will be called with information about the error.

    Returns void

  • Calls the requestToken REST API endpoint to obtain an Ably Token according to the specified TokenParams and AuthOptions. Both TokenParams and AuthOptions are optional. When omitted or null, the default token parameters and authentication options for the client library are used, as specified in the ClientOptions when the client library was instantiated, or later updated with an explicit authorize request. Values passed in are used instead of, rather than being merged with, the default values. To understand why an Ably TokenRequest may be issued to clients in favor of a token, see Token Authentication explained.

    Parameters

    Returns void

  • Calls the requestToken REST API endpoint to obtain an Ably Token according to the specified TokenParams. When omitted or null, the default token parameters and authentication options for the client library are used, as specified in the ClientOptions when the client library was instantiated, or later updated with an explicit authorize request. Values passed in are used instead of, rather than being merged with, the default values. To understand why an Ably TokenRequest may be issued to clients in favor of a token, see Token Authentication explained.

    Parameters

    Returns void

  • Calls the requestToken REST API endpoint to obtain an Ably Token. The default token parameters and authentication options for the client library are used, as specified in the ClientOptions when the client library was instantiated, or later updated with an explicit authorize request. To understand why an Ably TokenRequest may be issued to clients in favor of a token, see Token Authentication explained.

    Parameters

    • Optional callback: tokenDetailsCallback

      A function which, upon success, will be called with a TokenDetails object. Upon failure, the function will be called with information about the error.

    Returns void

Generated using TypeDoc