Kong/insomnia · error · Error

auth transforming(fromPreRequestAuth): unknown auth grant…

Error message

auth transforming(fromPreRequestAuth): unknown auth grant type for oauth2: ${inputGrantType}

What it means

Thrown during fromPreRequestAuth conversion of an OAuth2 configuration into the pre-request script auth model: the grant_type value found in the request's oauth2 options does not map to any known grant (authorization_code, authorization_code_with_pkce, implicit, password_credentials, client_credentials, refresh_token). The offending grant type is interpolated.

Solutions

  1. Use one of the supported grants: authorization_code, authorization_code_with_pkce, implicit, password_credentials, client_credentials, refresh_token
  2. Update insomnia-scripting-environment if a newly added grant type is needed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/insomnia-scripting-environment/src/objects/auth.ts:502 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kong/insomnia@d9bb2b0142 (2026-08-26). Data as JSON: /api/errors/b902e266bc628250. Report an issue: GitHub.

Appendix: source

Thrown at packages/insomnia-scripting-environment/src/objects/auth.ts:502

        switch (inputGrantType) {
          case 'authorization_code':
          case 'authorization_code_with_pkce': {
            return 'authorization_code';
          }
          case 'implicit': {
            return 'implicit';
          }
          case 'password_credentials': {
            return 'password';
          }
          case 'client_credentials': {
            return 'client_credentials';
          }
          case 'refresh_token': {
            return 'refresh_token';
          }
          default: {
            throw new Error(
              `auth transforming(fromPreRequestAuth): unknown auth grant type for oauth2: ${inputGrantType}`,
            );
          }
        }
      })();

      const responseType = ((): OAuth2ResponseType => {
        const inputResponseType = findValueInOauth2Options('response_type', authObj.oauth2);
        // responseType is currently always set to '' in our request auth model, this should be investigated what is correct to be set
        if (['code', 'id_token', 'id_token token', 'none', 'token', ''].includes(inputResponseType)) {
          return inputResponseType as OAuth2ResponseType;
        }
        throw new Error(
          `unknown response type for oauth2: "${inputResponseType}", it could be: 'code' | 'id_token' | 'id_token token' | 'none' | 'token' | ''`,
        );
      })();

      return {

View on GitHub (pinned to d9bb2b0142)