nextauthjs/next-auth · info

'scope' is a string. Redundant workaround, please open an is

Error message

'scope' is a string. Redundant workaround, please open an issue.

What it means

Twitch returns its token endpoint `scope` field as a space-delimited string, but NextAuth's provider includes a `conform` workaround that handles the case where it is an array, joining it into a string. This console.warn fires when Twitch already returns a string, making the normalization workaround unnecessary; the library asks you to report it so the workaround can be removed. It is informational and does not break the flow.

Source

Thrown at packages/core/src/providers/twitch.ts:94

    issuer: "https://id.twitch.tv/oauth2",
    id: "twitch",
    name: "Twitch",
    type: "oidc",
    client: { token_endpoint_auth_method: "client_secret_post" },
    authorization: {
      params: {
        scope: "openid user:read:email",
        claims: {
          id_token: { email: null, picture: null, preferred_username: null },
        },
      },
    },
    token: {
      async conform(response) {
        const body = await response.json()
        if (response.ok) {
          if (typeof body.scope === "string") {
            console.warn(
              "'scope' is a string. Redundant workaround, please open an issue."
            )
          } else if (Array.isArray(body.scope)) {
            body.scope = body.scope.join(" ")
            return new Response(JSON.stringify(body), response)
          } else if ("scope" in body) {
            delete body.scope
            return new Response(JSON.stringify(body), response)
          }
        } else {
          const { message: error_description, error } = body
          if (typeof error !== "string") {
            return new Response(
              JSON.stringify({ error: "invalid_request", error_description }),
              response
            )
          }
          console.warn(

View on GitHub (pinned to a1a16a5a77)

Solutions

  1. Ignore the warning — it is harmless and the token flow continues normally
  2. Open an issue with the NextAuth.js/Auth.js repo per the message so the redundant workaround can be removed
  3. Upgrade to a newer adapter/authjs version where the Twitch workaround may already be removed
Defensive patterns

Strategy: validation

Validate before calling

const body = await response.json()
if (body && typeof body.scope === "string") {
  // already normalized; no workaround needed
}

Type guard

function scopeIsString(v: unknown): v is string {
  return typeof v === "string"
}

Prevention

When it happens

Trigger: Any successful Twitch OAuth token exchange where the response body's `scope` field is already a string (Twitch's normal behavior), hitting the `typeof body.scope === "string"` branch in token.conform.

Common situations: Standard Twitch sign-in with recent Twitch API versions that return scope as a string; developers seeing the warning while debugging provider token responses.

Related errors


AI-assisted analysis of nextauthjs/next-auth@a1a16a5a77 (2026-08-28). Data as JSON: /api/errors/151e82bf98e1b60d. Report an issue: GitHub.