Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace auth

Index

Functions

Const getCaptchaImage

  • getCaptchaImage(instance?: Got): Promise<{ imageURL: undefined | string; token: undefined | string }>
  • Get unique captcha identifier and URL to the image

    Parameters

    • instance: Got = defaults.instance

      The got instance to use

    Returns Promise<{ imageURL: undefined | string; token: undefined | string }>

    The UID of captcha image and URL to the image source URL

Const getLoginOptions

  • getLoginOptions(instance?: Got): Promise<{ defaultPassword: string; initStatus: number; isCaptchaEnabled: boolean; routerIdentifier: string; routerName: string }>
  • Get available metadata from router login page

    Parameters

    • instance: Got = defaults.instance

      The got instance to use

    Returns Promise<{ defaultPassword: string; initStatus: number; isCaptchaEnabled: boolean; routerIdentifier: string; routerName: string }>

    Publicated router metadata you can see when you try to login

Const getLoginToken

  • getLoginToken(instance?: Got, options?: ILoginOptions): Promise<string>
  • Get authorized session token by sending login request

    Parameters

    • instance: Got = defaults.instance

      The got instance to use

    • options: ILoginOptions = ...

      The login option including username and password

    Returns Promise<string>

    The token string which can be applied to esm_session_id cookie

Const setSessionToken

  • setSessionToken(cookieJar: CookieJar, token: string, url?: string): Promise<CookieJar>
  • Set login token to cookieJar

    Parameters

    • cookieJar: CookieJar

      The cookieJar to be set

    • token: string

      The token to set

    • url: string = 'http://192.168.0.1/'

      The url to be applied

    Returns Promise<CookieJar>

    Updated cookieJar with token

Generated using TypeDoc