Session Reset Tool

Fix OAuth2 "too many redirects" and 403 errors

Getting "too many redirects" or 403 Forbidden?
This happens when a service restarts and your browser has stale OAuth2 cookies with old CSRF tokens.

1 Recommended: Download Script

The fastest and most reliable fix. Works on Linux and macOS.

# Download, make executable, and run
curl -O https://nginx.ai-servicers.com/scripts/clearbrowser
chmod +x clearbrowser
./clearbrowser brave          # Clear Brave (default)
./clearbrowser chrome         # Clear Chrome
./clearbrowser firefox        # Clear Firefox
./clearbrowser all            # Clear all browsers
./clearbrowser --dry-run      # Preview what would be deleted

The script automatically kills the browser, deletes cookie files, and cleans up backups.

2 Manual: Delete Cookie Files

If you can't run scripts, delete the files manually:

Brave
Chrome
Firefox
macOS

Linux

# 1. Close Brave completely
pkill -9 -f brave

# 2. Delete cookie files
rm ~/.config/BraveSoftware/Brave-Browser/Default/Cookies
rm ~/.config/BraveSoftware/Brave-Browser/Default/Cookies-journal

# 3. Open Brave and navigate to the service

Linux

# 1. Close Chrome completely
pkill -9 -f chrome

# 2. Delete cookie files
rm ~/.config/google-chrome/Default/Cookies
rm ~/.config/google-chrome/Default/Cookies-journal

# 3. Open Chrome and navigate to the service

Linux

# 1. Close Firefox completely
pkill -9 -f firefox

# 2. Delete cookie files (all profiles)
find ~/.mozilla/firefox -name "cookies.sqlite" -delete

# 3. Open Firefox and navigate to the service

macOS Paths

# Brave
rm ~/Library/Application\ Support/BraveSoftware/Brave-Browser/Default/Cookies

# Chrome
rm ~/Library/Application\ Support/Google/Chrome/Default/Cookies

# Firefox
find ~/Library/Application\ Support/Firefox/Profiles -name "cookies.sqlite" -delete

3 Quick Fix: Reset & Re-login (works on mobile)

Clears the OAuth2 session cookie for a service, then redirects you back so you get a fresh Keycloak login. Works on any device including phones.

How it works: Signs you out of the OAuth2 session for that service, then sends you back. You'll re-authenticate through Keycloak and get a fresh session. No browser settings needed.

4 Clear Site Data (Desktop browsers)

If Quick Fix doesn't work, the service may have stale tokens in browser storage. Clear everything for a specific site:

Brave
Chrome
Firefox
Brave: Copies brave://settings/content/all?searchSubpage=HOST. Paste in address bar, click the trash icon next to the site, then reload.
Chrome: Copies chrome://settings/content/all?searchSubpage=HOST. Paste in address bar, click the trash icon next to the site, then reload.
Firefox: Copies about:preferences#privacy. Paste in address bar, scroll to "Cookies and Site Data", click "Manage Data", search for the hostname, and remove it.

5 Per-Service Sign Out

Sign out from individual services to clear their OAuth2 session cookies:

6 Keycloak Logout

Log out from the central SSO to clear the Keycloak session:

Why does this happen?
When services restart, OAuth2 proxy generates new CSRF tokens. Old cookies contain stale tokens that fail validation, causing a redirect loop:
  1. Browser sends old _oauth2_proxy cookie
  2. OAuth2 proxy rejects it (CSRF mismatch)
  3. Redirects to auth, but old cookie is still sent
  4. Loop continues until cookies are cleared
Quick test: If the service works in Incognito/Private mode, it's definitely a cookie issue. Use the script above to fix it.