Supabase Auth /token API 429 rate limit reached
summary
I'm getting a rate limit error with the superbase auth API.
I'd like to resolve this, so any information would be greatly appreciated.
detail
This error tends to occur when refreshing a token.
I suspect the cause is excessive calls to the token API somewhere.
I'm using Next.js for this full-stack application. The middleware only calls the token once.
I've also considered various other possibilities.
I created a createClient similar to the one in the following article and use it in many files.
https://supabase.com/docs/guides/auth/server-side/creating-a-client?queryGroups=environment&environment=server
I seem to remember seeing information online that suggests there's a specific time to call the token within createClient, so this might be the problem.
Any information would be greatly appreciated.
Creating a Supabase client for SSR | Supabase Docs
Configure your Supabase client to use cookies

2 Replies
@Yuki Arai you may be creating multiple Supabase clients across files, causing repeated token refresh calls and hitting the /token rate limit. Refactor to share a single client instance and ensure token refresh is only triggered when needed.
@OakRatos
I see, that was the problem after all.
Thanks! I'll fix it.