interface AuthApi {
    getOAuthGoogleLoginUrl(input): string;
    getRequiredVersion(): string;
    login(input): Promise<LoginResponse>;
    logout(): Promise<void>;
    onetimeTokenLogin(input): Promise<LoginResponse>;
    ping(): Promise<PingResponse>;
    refresh(): Promise<RefreshResponse>;
    resendTwoFactorCode(input): Promise<ResendTwoFactorCodeResponse>;
    verifyTwoFactorAuth(input): Promise<LoginResponse>;
}

Hierarchy

Implemented by

Methods

  • Creates a url to auth service /auth/google with query params

    On the frontend, you must:

    • Redirect page to that URL
    • Auth API will auto redirect to twitter's page on response
    • Twitter will hit the callback url on auth service to login, before redirecting to redirect url
    • Redirect url will have code/onetimeToken query param, which can be used to login

    Parameters

    Returns string

  • On setup, we can call getRequiredVersion and ping() to confirm that the service exists and that it is of a matching version semantically E.g. if required version is ~2.5 and the api returns 2.6.3, then no issue If returns 3.0.1, should log a warning If returns 1.0.2, should throw error saying it isn't new enough

    Returns string

  • Perform a email + password login to the auth service, updating the session state in the session service.

    If two factor auth is configured, this will require a second call to the two factor auth endpoint.

    Parameters

    • input: {
          email: string;
          password: string;
      }
      • email: string
      • password: string

    Returns Promise<LoginResponse>

  • Perform a user logout, clearing the session state in the session service.

    Returns Promise<void>

  • Perform login via one time token (retrieved from oauth process)

    Parameters

    • input: {
          onetimeToken: string;
      }
      • onetimeToken: string

    Returns Promise<LoginResponse>

  • Perform a refresh of the access token, updating the session state. Will throw 401 errors on expiry or invalid refresh token.

    The caller should also handle 502 errors by retrying the request.

    Returns Promise<RefreshResponse>

Generated using TypeDoc