bruno icon indicating copy to clipboard operation
bruno copied to clipboard

OAuth 2.0 : Refresh token not working at all

Open RVBastien opened this issue 8 months ago • 6 comments

I have checked the following:

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

This bug is:

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

Bruno version

3.2.0

Operating System

Windows 11

Describe the bug

When using OAuth2 in Bruno, clicking Refresh Token from the Auth tab does not reliably perform a usable refresh flow for a custom refresh endpoint.

I use a custom backend refresh route (POST /auth/refresh) that returns a token-like JSON response such as:

{
  "access_token": "...",
  "refresh_token": "...",
  "expires_in": 420
}

What I observed:

  1. A manual POST request to my refresh endpoint works correctly.

  2. The same endpoint also works when called from a Bruno script using bru.sendRequest(...).

  3. However, the built-in Auth tab > Refresh Token flow either:

    • shows No access token received from authorization server, or
    • does not provide enough visibility to understand what Bruno actually sent / received.

In earlier debugging attempts, clicking Refresh Token did not appear to hit my server at all. After switching to a script-based workaround, I confirmed that the backend itself is fine and can refresh successfully when called manually.

This makes it look like the built-in OAuth2 refresh flow is either:

  • not issuing the request I expect,
  • not exposing the actual request/response details,
  • or not handling custom refresh endpoints robustly.

Steps to reproduce

  1. Create a request in Bruno using OAuth2 auth.

  2. Configure:

    • Access Token URL
    • Refresh Token URL
    • Token ID / Credential ID
    • optional custom headers / params if needed by the backend
  3. Obtain an initial token successfully.

  4. Wait until the access token expires, or use a short-lived access token.

  5. Click Refresh Token in the Auth tab.

  6. Observe that Bruno does not provide enough visibility into the actual refresh request / response, and the flow fails with a generic error such as:

    • No access token received from authorization server

Expected behavior

  • Bruno should perform the refresh request against the configured refresh endpoint.

  • If the refresh fails, Bruno should clearly show:

    • request URL
    • request method
    • response status
    • response body
  • If the response is accepted, Bruno should update the OAuth2 credential store consistently.

Actual behavior

  • The built-in refresh flow fails with a generic OAuth2 error.
  • The actual HTTP request / response is not clearly visible from the UI in this scenario.
  • A manual request to the same endpoint works.
  • A script-based workaround using bru.sendRequest(...) also works.

Why I believe this is a Bruno issue

I verified the backend independently:

  • Manual POST /auth/refresh works.
  • Calling the same endpoint from a Bruno pre-request script works.
  • The server returns a successful refresh response with access_token, refresh_token, and expires_in.
  • The problem only happens with the built-in OAuth2 refresh flow in the Auth UI.

So this does not appear to be a backend-only issue.

Workaround

I worked around this by bypassing the built-in refresh button and doing the refresh in a Bruno script with bru.sendRequest(...).

That works, but it is not ideal because:

  • it bypasses Bruno's built-in OAuth2 refresh behavior,
  • and it does not integrate cleanly with Bruno's internal OAuth2 credential store.

Additional context

My backend is running locally and the refresh endpoint is reachable from Bruno via normal requests.

Possibly related:

  • missing visibility/logging for OAuth2 collection/folder get token and refresh requests
  • localhost / Windows / WSL-related networking edge cases

Repro collection

I can provide a minimal repro collection if needed.

Screenshots / logs

I can provide:

  • screenshots of the OAuth2 configuration
  • console logs from the Bruno script workaround
  • backend logs showing manual refresh works while the built-in flow fails

.bru file to reproduce the bug

No response

Screenshots/Live demo link

Image

RVBastien avatar Mar 24 '26 15:03 RVBastien

🔗 Related PRs

usebruno/bruno#6164 - fix: get certs and proxy config based on oauth2 token and refresh urls instead of resource url [merged] usebruno/bruno#6186 - fix: handle optional clientSecret in OAuth2 authorization header [merged] usebruno/bruno#6313 - fix: gRPC oauth2 call is not taking ssl cert and proxy config [merged] usebruno/bruno#6592 - feat: enhance OAuth2 support in snippet generation [merged] usebruno/bruno#7220 - fix: oauth2 credential management improvements [merged]


📝 Issue Planner

Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

  • [ ] Create Plan

🧪 Issue enrichment is currently in open beta.

You can configure auto-planning by selecting labels in the issue_enrichment configuration.

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

💬 Have feedback or questions? Drop into our discord!

coderabbitai[bot] avatar Mar 24 '26 15:03 coderabbitai[bot]

Hi @RVBastien just confirming this wasn't working for you in any prior versions of Bruno?

james-ha-bruno avatar Mar 25 '26 03:03 james-ha-bruno

This is my first time using Bruno, I wouldn’t know, i will try to provide you with more information today by pulling the project and adding logs.

RVBastien avatar Mar 25 '26 08:03 RVBastien

@RVBastien you can see the app version in the bottom right corner of Bruno too!

james-ha-bruno avatar Mar 25 '26 14:03 james-ha-bruno

I am using Bruno since its latest releases, its the 3.2.0. Anyway, here my pull request that solves the issue. https://github.com/usebruno/bruno/pull/7573

RVBastien avatar Mar 25 '26 14:03 RVBastien

this is occurring for me as well but in my case it's in the client credentials flow.. Using bruno 3.3.0

dsl3zm avatar Apr 28 '26 18:04 dsl3zm