Skip to content

req.getAuthMode() returns 'none' when API Key is used #7579

@DuckThom

Description

@DuckThom

I have checked the following:

  • I have searched existing issues and found nothing related to my issue.

This bug is:

  • making Bruno unusable for me
  • slowing me down but I'm able to continue working
  • annoying
  • this feature was working in a previous version but is broken in the current release.

Bruno version

3.2.0

Operating System

Debian 13.4 Trixie

Describe the bug

Using req.getAuthMode() returns none when API Key is used with unconventional key/header name.

It looks like the auth type is checked here based on request headers rather than the request configuration:

getAuthMode() {
if (this.req?.oauth2) {
return 'oauth2';
} else if (this.headers?.['Authorization']?.startsWith('Bearer')) {
return 'bearer';
} else if (this.headers?.['Authorization']?.startsWith('Basic') || this.req?.auth?.username) {
return 'basic';
} else if (this.req?.awsv4) {
return 'awsv4';
} else if (this.req?.digestConfig) {
return 'digest';
} else if (this.headers?.['X-WSSE'] || this.req?.auth?.username) {
return 'wsse';
} else {
return 'none';
}
}

So when a key like foo is used, the auth mode is returned as 'none' rather than something like 'api_key'

.bru file to reproduce the bug

opencollection: 1.0.0
info:
  name: getAuthType repro
config:
  proxy:
    inherit: true
    config:
      protocol: http
      hostname: ''
      port: ''
      auth:
        username: ''
        password: ''
      bypassProxy: ''
items:
  - info:
      name: Untitled
      type: http
      seq: 1
    http:
      method: GET
      url: https://example.com
      auth:
        type: apikey
        key: foo
        value: bar
        placement: header
    runtime:
      scripts:
        - type: before-request
          code: console.log('request auth mode', req.getAuthMode())
    settings:
      encodeUrl: true
      timeout: 0
      followRedirects: true
      maxRedirects: 5
bundled: true
extensions:
  bruno:
    ignore:
      - node_modules
      - .git
    exportedAt: '2026-03-26T09:43:44.745Z'
    exportedUsing: Bruno

Screenshots/Live demo link

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions