HTTP 401 Unauthorized When Opening Application in a New Browser Tab During OAuth Login
search cancel

HTTP 401 Unauthorized When Opening Application in a New Browser Tab During OAuth Login

book

Article ID: 432793

calendar_today

Updated On:

Products

VMware Avi Load Balancer

Issue/Introduction

Users accessing an application protected by Avi Load Balancer OAuth/SSO receive an HTTP 401 Unauthorized response when opening the application URL in a new browser tab while an existing OAuth login flow is still in progress in another tab.

Environment

 

  • Product: VMware Avi Load Balancer
  • Component: OAuth SSO enabled on Virtual Service
  • Versions Affected: All versions
  • Identity Provider: OAuth

 

Cause

When a user first accesses the application, Avi (Virtual Service) issues a short-lived OAuth handshake cookie, using the cookie name configured in the OAuth profile, to track the in-progress OAuth session.This cookie has a TTL of 2 minutes and is strictly valid only when returned via the OAuth Callback URI as part of the IdP redirect.

Since the Handshake Cookie is scoped to the application domain (e.g., portal.foo.bar), the browser automatically attaches it to any subsequent request to that domain — including a new tab opened by the user before login completes.

When Virtual Service receives the new tab request, it detects the Handshake Cookie on a non-callback URI and rejects it with HTTP 401. This is intentional security behavior designed to prevent OAuth handshake replay attacks. From AVI ALB's perspective, a Handshake Cookie arriving outside the callback URI is indistinguishable from a replay attack attempt, so it is rejected in both cases.

Example flow that triggers the 401:

  1. User opens portal.foo.bar in Tab 1 → Avi sets Handshake Cookie → Redirects to IdP login page
  2. Before completing login user authentication, user opens portal.foo.bar in Tab 2
  3. Browser sends the Handshake Cookie with the Tab 2 request
  4. Avi detects the Handshake Cookie on a non-callback URI → Returns HTTP 401

Resolution

This behavior is addressed and fixed in the below Avi releases. There is no additional configuration change required to disable or modify this enforcement beyond upgrading to a fixed version.

Fixed Version: 31.2.3, 32.x and 30.2.7

AV-268360: OAuth authentication fails with a 401 Unauthorized error if the user tries to log in across multiple tabs simultaneously.

30.2.7 Release Note


Workaround:
Complete the login fully in the first tab before opening the application in any additional tab. Once Avi issues a Session Cookie, all subsequent tabs will share the authenticated session without error.