AniLink - v2.0.0
    Preparing search index...

    Function buildMalAuthorizationUrl

    • buildMalAuthorizationUrl is the PKCE helper that builds the MyAnimeList OAuth2 authorization URL for getMalAccessToken.

      It encodes the client identity and PKCE challenge from MalAuthorizationCodeRequest and returns the URL to open in a browser. The current implementation sends code_challenge_method=S256; verify that method against the linked MAL authorization reference before relying on the helper. Validate the state on redirect before exchanging the code via getMalAccessToken.

      Parameters

      • clientId: string

        The MAL application client ID from MalAuthorizationCodeRequest.clientId.

      • codeChallenge: string

        The PKCE challenge generated for the login attempt; this helper sends it with the S256 method.

      • Optionalstate: string

        Optional opaque CSRF state to validate on the redirect.

      Returns string

      The fully encoded authorization URL for the MAL OAuth flow.

      const url = buildMalAuthorizationUrl("client-id", "pkce-challenge", "csrf-state");
      // Open url in a browser, then exchange the returned code with getMalAccessToken.