Function login

  • Logs in to Moodle using the provided credentials and returns a token.

    Parameters

    • base_url: string | URL

      The base URL of the Moodle site.

    • username: string

      The username of the user.

    • password: string

      The password of the user.

    Returns Promise<string>

    A Promise that resolves to a token string.

    Throws

    An error if the HTTP response is not ok or if the JSON response contains an error message.

Generated using TypeDoc