// troubleshooting guide · supabase

Supabase 'JWT Expired' Error (PGRST301)

Status
Workaround available
platforms:
Web, Next.js, Flutter, mobile
updated:
November 22, 2026
reports:
4
Method
how we research
Share

RUNBOOK · supabase/jwt-expired4 FIXES

// quick answer

The access token (valid about one hour) was not refreshed. Refresh the session or use the SSR middleware; in the dashboard, sync your computer's clock.

Most likely fix: Refresh the session

How to fix it

// try these in order, the most common fix is first

  1. FIX 1Refresh the session

    1. 01Call supabase.auth.refreshSession() and retry the request
    2. 02Keep autoRefreshToken enabled on the client
    3. 03Handle onAuthStateChange so the new token replaces the old one
    Did this fix it?
  2. FIX 2Next.js and SSR: refresh in middleware

    1. 01Use the @supabase/ssr package
    2. 02Create the server client from request cookies
    3. 03Call supabase.auth.getUser() in middleware so tokens refresh on each request
    Did this fix it?
  3. FIX 3Dashboard JWT expired

    1. 01Enable automatic date and time in your OS
    2. 02Reload the dashboard and sign in again
    Did this fix it?
  4. FIX 4Check keys

    1. 01Confirm the key and URL belong to the same project
    2. 02Don't match on PGRST301 alone: bad signatures and wrong keys give similar errors
    Did this fix it?

SANDBOX · supabase RUNS IN YOUR BROWSER

Try it: edit a table, call it from your app, run SQL

A hands-on Supabase-style sandbox, including the spots where users get stuck. See where problems like this one start. 1-2 minutes, nothing is saved.

Symptoms

Requests return 401 with 'JWT expired' or code PGRST301, often after the tab or server has been idle for an hour.

Why it happens

  • C-01Session not refreshed after the ~1 hour token lifetime
  • C-02Server-side code reusing a stale token
  • C-03System clock out of sync (dashboard error)
  • C-04Wrong anon key or JWT secret for the project

// this guide also covers

  • supabase jwt expired
  • pgrst301
  • supabase token expired refresh

Still not working?

If Supabase keeps failing, you're not alone. See every Supabase problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us

Watch Supabase Get an email when its price changes, it has an outage, or we publish a new fix. No spam.

Fixed it? Share this guide

The same problem in other apps

All not loading, error messages & connection guides →

Other Supabase errors

All 16 Supabase errors and fixes →