iwf
    Preparing search index...

    Interface AuthProvider

    Authentication operations required by upload(), including custom providers.

    interface AuthProvider {
        getAxiosInstance(): AxiosInstance;
        getCsrfToken(site: string): Promise<string>;
        getUserAgent(): string;
    }

    Implemented by

    Index
    • Return the HTTP client used to post edits. Configure it with the provider's credentials or session cookies and required authentication headers. The client must propagate transport and authentication failures without exposing credentials; upload() maps unsuccessful MediaWiki API response bodies.

      Returns AxiosInstance

      The authenticated Axios client.

    • Return a CSRF token for the authenticated account on the given site.

      Parameters

      • site: string

        Server origin, such as https://www.wikidata.org, rather than an API endpoint.

      Returns Promise<string>

      An authenticated, non-anonymous CSRF token; reject anonymous sessions and propagate authentication failures.

    • Identify the calling application. upload() sends this User-Agent on preflight reads and edit requests; provider-owned token and login requests must use the same identification themselves.

      Returns string

      A descriptive application User-Agent, ideally including contact information.