waifuim
    Preparing search index...

    Class AuthenticationService

    Index

    Constructors

    Methods

    • Revoke (delete) an API key.

      Permanently deletes an API key. Any requests using this key will be rejected immediately. This action cannot be undone.

      Parameters

      • id: number

        The API key ID to revoke.

      Returns Promise<void>

      AuthenticationRequired if authentication is missing.

      ApiError with status 401 if authentication is invalid.

    • Login with Discord OAuth2. Exchange a Discord OAuth2 authorization code for a JWT token.

      Flow:

      1. Redirect user to Discord OAuth2 authorization URL
      2. User authorizes the application
      3. Discord redirects back with a code parameter
      4. Send the code to this endpoint to get a JWT token

      The JWT token should be included in subsequent requests as: Authorization: Bearer {token}

      Parameters

      • code: string

        The Discord authorization code.

      Returns Promise<string>

      The JWT token.

      ApiError with status 400 if invalid or expired authorization code.

    • Update an API key.

      Update the description or expiration date of an existing API key. You cannot change the key itself - create a new one if needed.

      Parameters

      Returns Promise<ApiKeySafe>

      The updated API key

      AuthenticationRequired if authentication is missing.

      ApiError with status 400 if invalid update data.

      ApiError with status 401 if authentication is invalid.

      ApiError with status 404 if API key not found or doesn't belong to you.