• Create a new authentication token based on the given information. The new token is returned as part of the response body and must be stored by the client. It cannot be read again in cleartext and is lost, if the client loses the token. An authentication has a lifetime. It can be unbound, meaning it will not expire. Or it has a limited lifetime after which it expires. The requested limited lifetime is requested by the client in seconds.

    Parameters

    • payload: {
          apiEndpoint: string | URL;
          apiToken: string;
          capabilities: {
              endpoint: "accountWithdraw" | "accountGetBalances" | "accountGetAddresses" | "aliasesGetAliases" | "aliasesSetAlias" | "aliasesGetAlias" | "aliasesRemoveAlias" | "channelsFundChannels" | "channelsOpenChannel" | "channelsGetChannels" | "channelsRedeemTickets" | "channelsGetTickets" | "channelsGetChannel" | "channelsCloseChannel" | "messagesWebsocket" | "messagesSign" | "messagesSendMessage" | "nodeGetVersion" | "nodeStreamWebsocket" | "nodePing" | "nodeGetPeers" | "nodeGetMetrics" | "nodeGetInfo" | "nodeGetEntryNodes" | "peerInfoGetPeerInfo" | "settingsGetSettings" | "settingsSetSetting" | "ticketsGetStatistics" | "ticketsRedeemTickets" | "ticketsGetTickets" | "tokensCreate" | "tokensGetToken" | "tokensDelete";
              limits: {
                  conditions?: {
                      max?: number;
                  };
                  type: string;
              }[];
          }[];
          description: string;
          lifetime: number;
          timeout?: number;
      }
      • apiEndpoint: string | URL

        The API endpoint for authentication.

      • apiToken: string

        The API token for authentication.

      • capabilities: {
            endpoint: "accountWithdraw" | "accountGetBalances" | "accountGetAddresses" | "aliasesGetAliases" | "aliasesSetAlias" | "aliasesGetAlias" | "aliasesRemoveAlias" | "channelsFundChannels" | "channelsOpenChannel" | "channelsGetChannels" | "channelsRedeemTickets" | "channelsGetTickets" | "channelsGetChannel" | "channelsCloseChannel" | "messagesWebsocket" | "messagesSign" | "messagesSendMessage" | "nodeGetVersion" | "nodeStreamWebsocket" | "nodePing" | "nodeGetPeers" | "nodeGetMetrics" | "nodeGetInfo" | "nodeGetEntryNodes" | "peerInfoGetPeerInfo" | "settingsGetSettings" | "settingsSetSetting" | "ticketsGetStatistics" | "ticketsRedeemTickets" | "ticketsGetTickets" | "tokensCreate" | "tokensGetToken" | "tokensDelete";
            limits: {
                conditions?: {
                    max?: number;
                };
                type: string;
            }[];
        }[]
      • description: string
      • lifetime: number
      • Optional timeout?: number

        optional timeout for the requests

    Returns Promise<{
        token: string;
    }>

    A Promise that resolves to the generated token which must be used when authenticating for API calls.

    Throws

    An error that occurred while processing the request.