Auth
Your users sign in through a custom OIDC provider in Supabase, but the app treats them as signed out
Cataloged November 17, 2026 · Supabase
Symptom
The user is signed in on the custom OIDC provider. Supabase queries return empty lists, or permission errors, as if that user were signed out. This applies after you add the Custom OIDC provider and the Supabase client passes that provider's token through accessToken. If the app does not use a custom OIDC provider with Supabase, this card does not apply. The Supabase changelog for November 17, 2026, "Add custom OIDC providers for third-party auth from the Dashboard", says the Third-Party Auth page now supports a Custom OIDC option, in addition to Firebase, Clerk, WorkOS, Auth0, and Amazon Cognito. The Supabase docs page "Custom OIDC provider", updated November 16, 2026, says: "Without a role claim, requests run as the anon role." The sample policy on that page that reads a user's own rows is written to authenticated. A request running as the anon role does not match a policy written to authenticated. That page does not name an error message for the anon case. The same page says: "The sub claim identifies the user. auth.uid() casts sub to uuid, so it fails if your provider issues subjects that are not UUIDs." sub is the user id in the token. The page says the cast fails. It does not name a longer error. That page says: "Set role to authenticated for signed-in users." It says to use the provider's custom claims or token template feature to add that claim. Once the rows do show, that page says: "Your project trusts every issuer you add, and sub values from different issuers can collide." If the project has more than one issuer, or it also uses Supabase Auth, add the restrictive policy that page shows for the iss claim. iss is the issuer address inside the token. That page says "make sure you don't omit the as restrictive clause." The Supabase docs page "Third-party auth" says: "It is not possible to disable Supabase Auth at this time."
Root cause
The provider can show the user as signed in while the token Supabase receives has no role claim, or while a policy still calls auth.uid() on a sub that is not a UUID. The Supabase changelog entry "Add custom OIDC providers for third-party auth from the Dashboard" (November 17, 2026) says the Third-Party Auth page now supports a Custom OIDC option, in addition to Firebase, Clerk, WorkOS, Auth0, and Amazon Cognito. That entry says to open Authentication, then Third-Party Auth, and select Add provider, then Custom OIDC. Enter the issuer URL. It says the issuer's signing keys must be available at the issuer's /.well-known/openid-configuration. It says: "Supabase then accepts JWTs signed by that issuer." It says: "Issuer URLs must use https:// and can't include a query string, fragment, or credentials." Custom issuers already registered through the Management API now appear in the provider list, labeled Custom OIDC, and you can delete them from the Dashboard. That entry says: "The Dashboard doesn't yet support custom JWKS URLs or inline JWKS. Use the Management API for those." The Supabase docs page "Custom OIDC provider" says the provider must expose an OIDC Issuer Discovery URL, served at /.well-known/openid-configuration. It says: "It signs JWTs with an asymmetric key and includes a kid header parameter. Symmetrically signed JWTs, such as HS256, are not supported." The Supabase docs page "Third-party auth" says: "The signed JWTs must have a kid header parameter to identify which key must be used." The Custom OIDC page says the JWTs must contain a role claim, and: "The issuer URL must use HTTPS." That page says: "Custom OIDC providers are not available in the Supabase CLI. There is no supabase/config.toml option for them." Its section "Assign the role claim" says: "Your Supabase project inspects the role claim in every JWT sent to it, to assign the correct Postgres role when using the Data API, Storage or Realtime authorization. Without a role claim, requests run as the anon role." It says: "Set role to authenticated for signed-in users." It says: "Use your provider's custom claims or token template feature to add it." The client section says to pass an accessToken function that "returns your provider's JWT for the current user, or null if there is no signed-in user." The sample calls createClient with the project URL, the publishable key, and accessToken: async () => getAccessTokenFromYourProvider(). The page's sample uses placeholders for the URL and the key, not a real key. It says to replace getAccessTokenFromYourProvider with the call the provider's SDK uses to get the current user's JWT. For Row Level Security, that page says: "The sub claim identifies the user. auth.uid() casts sub to uuid, so it fails if your provider issues subjects that are not UUIDs." It says to read the claim directly. The sample policy is named "Users can read their own rows", for select, to authenticated, using (user_id = (select auth.jwt()->>'sub')). It says user_id must be a text column. The section "Restrict access by issuer" says: "Your project trusts every issuer you add, and sub values from different issuers can collide." If you use more than one issuer, or you also use Supabase Auth, that page says to add a restrictive policy that checks iss. The sample policy is named "Restrict access to trusted issuers", as restrictive, to authenticated, using ((auth.jwt()->>'iss' = 'https://<project-ref>.supabase.co/auth/v1') or (auth.jwt()->>'iss' = 'https://login.example.com')). Those two URLs are the placeholders on that page. That page says "make sure you don't omit the as restrictive clause." The Supabase docs page "Third-party auth" says that when you add an integration, "the API will trust JWTs issued by the provider similar to how it trusts JWTs issued by Supabase Auth." It says the JWT signing keys "are checked for changes periodically." It says: "If you are rotating your keys (when supported) allow up to 30 minutes for the change to be picked up." It says: "It is not possible to disable Supabase Auth at this time."
Before and after
The policy name, for select, to authenticated, and table_name match the sample on the Supabase docs page "Custom OIDC provider". The using line in the before block is not that sample. That page says auth.uid() casts sub to uuid, so it fails if the provider's subjects are not UUIDs. It does not name a longer error. The after block is the two samples on that page. The first reads (select auth.jwt()->>'sub') into user_id, and that page says user_id must be a text column. The second is the restrictive issuer policy. https://<project-ref>.supabase.co/auth/v1 and https://login.example.com are the placeholders printed on that page. They are not a real project. That page says "make sure you don't omit the as restrictive clause." This pair does not show a token. That page says: "Without a role claim, requests run as the anon role." A policy written to authenticated does not match that role. That page does not name an error message for the anon case.
Before
create policy "Users can read their own rows" on table_name for select to authenticated using (user_id = auth.uid());
After
create policy "Users can read their own rows"
on table_name
for select
to authenticated
using (user_id = (select auth.jwt()->>'sub'));
create policy "Restrict access to trusted issuers"
on table_name
as restrictive
to authenticated
using (
(auth.jwt()->>'iss' = 'https://<project-ref>.supabase.co/auth/v1')
or
(auth.jwt()->>'iss' = 'https://login.example.com')
);Fix prompt
In this project only. Do not scan or test anyone else's app. Do not open anyone else's Supabase project. Do not print keys, tokens, passwords, JWTs, row contents, or environment variable values. When you mention a variable, print the name only. Do not paste a token into a website. Do not decode a token yourself. 1. This prompt applies if this project signs users in through a custom OIDC provider and sends that provider's JWT to Supabase. If it does not, say so and stop. This card does not apply. 2. In this project's own Supabase client, find createClient and say whether it passes accessToken. The Supabase docs page "Custom OIDC provider" says to pass an accessToken function that "returns your provider's JWT for the current user, or null if there is no signed-in user." The sample on that page calls createClient with the project URL, the publishable key, and accessToken: async () => getAccessTokenFromYourProvider(). The URL and the key in that sample are placeholders, not real values. Replace getAccessTokenFromYourProvider with the call this project's provider SDK already uses to read the current user's JWT. Do not invent a method name. If this project has no such call, say so and stop. Do not print the token or the key. Show me the diff only if you change the client. 3. Confirm this project's provider tokens carry role set to authenticated. That page's section "Assign the role claim" says: "Your Supabase project inspects the role claim in every JWT sent to it, to assign the correct Postgres role when using the Data API, Storage or Realtime authorization. Without a role claim, requests run as the anon role." It says: "Set role to authenticated for signed-in users." It says: "Use your provider's custom claims or token template feature to add it." If that setting lives in the provider's dashboard and not in this repository, say so. Tell me the claim that page requires. Do not invent a template field name. Do not print a token. Do not edit a token by hand. A policy written to authenticated does not match a request running as the anon role. That page does not name an error message for the anon case. Do not invent one. 4. Find owner policies in this project that serve these users and call auth.uid(). That page says: "The sub claim identifies the user. auth.uid() casts sub to uuid, so it fails if your provider issues subjects that are not UUIDs." sub is the user id in the token. It says the cast fails. It does not name a longer error. Do not invent one. If you cannot tell whether sub is a UUID without reading a token, say so and do not guess. Tell me to decode my own token locally. Where sub is not a UUID, rewrite the owner check so a text user_id column is compared to (select auth.jwt()->>'sub'). The sample policy on that page is named "Users can read their own rows", for select, to authenticated, using (user_id = (select auth.jwt()->>'sub')). That page says user_id must be a text column. Use the table and column names this project already has. If that column is not text, say so and do not change the column type unless I ask. If sub is a UUID and the policy already uses auth.uid(), say so and do not rewrite it. Show me the diff only if you change a policy. 5. If this project uses more than one issuer, or it also uses Supabase Auth, add a restrictive policy that allows only the issuer addresses this project expects. Add it on each table these users read or write. That page says: "Your project trusts every issuer you add, and sub values from different issuers can collide." The sample policy is named "Restrict access to trusted issuers", as restrictive, to authenticated, using ((auth.jwt()->>'iss' = 'https://<project-ref>.supabase.co/auth/v1') or (auth.jwt()->>'iss' = 'https://login.example.com')). Those two URLs are placeholders on that page. Replace them with the issuer URLs this project registered. Include the Supabase Auth issuer from that sample, with this project's own project ref, only when this project also uses Supabase Auth. The Supabase docs page "Third-party auth" says: "It is not possible to disable Supabase Auth at this time." If you cannot tell whether this project also uses Supabase Auth, say so and ask me before you add that issuer. Do not leave login.example.com or <project-ref> in the file. That page says "make sure you don't omit the as restrictive clause." Do not omit it. Where this project already has Storage or Realtime policies for these users, add the same restrictive iss check, using the iss comparison from that sample. Do not invent a Storage or Realtime policy command that page does not show. If those policies are only in the Supabase Dashboard, say so and tell me to add the check there, in a project I own. If this project has one custom issuer and does not also use Supabase Auth, do not add the sample policy. Say what that page says about colliding sub values, and stop on this step. Show me the diff only if you add a policy. 6. Do not add a custom OIDC provider through the Supabase CLI or supabase/config.toml. That page says: "Custom OIDC providers are not available in the Supabase CLI. There is no supabase/config.toml option for them." Do not invent a config key. The changelog entry "Add custom OIDC providers for third-party auth from the Dashboard" (November 17, 2026) says to open Authentication, then Third-Party Auth, and select Add provider, then Custom OIDC, and enter the issuer URL. It says: "Issuer URLs must use https:// and can't include a query string, fragment, or credentials." It says the signing keys must be available at the issuer's /.well-known/openid-configuration. It says: "The Dashboard doesn't yet support custom JWKS URLs or inline JWKS. Use the Management API for those." Do not call the Management API. If this project needs a custom JWKS URL or inline JWKS, say so and stop. 7. Do not treat a fresh signing-key rotation as this bug. The Supabase docs page "Third-party auth" says the signing keys "are checked for changes periodically." It says: "If you are rotating your keys (when supported) allow up to 30 minutes for the change to be picked up." Do not change keys. Do not edit unrelated files. 8. Show me the diffs. Do not print row contents or tokens. Tell me to sign in through the provider in this project, copy my own access token, and decode it locally in a decoder I trust. Tell me never to paste that token into a random site. Tell me to confirm role is authenticated, iss equals the issuer I registered, and whether sub is a UUID. Then tell me to load a page that reads my own rows and confirm I see only my rows, and that the same request signed out returns none. Do not run that check yourself. Do not point it at a project I do not own. Do not print keys. Do not edit unrelated files.
Paste this into the coding tool that has your own project open.
2-minute self-check
These steps are for an app you own. Do not run them against someone else's project.
- In your own app, sign in through your provider. Copy your own access token and decode it locally, in a JWT decoder you trust on your own computer. Never paste tokens into random sites. Confirm the token has role set to authenticated, and an iss equal to the issuer you registered. Note whether sub is a UUID. sub is the user id in the token. iss is the issuer address in the token. The Supabase docs page "Custom OIDC provider" says: "Without a role claim, requests run as the anon role." It says: "Set role to authenticated for signed-in users." It says: "The sub claim identifies the user. auth.uid() casts sub to uuid, so it fails if your provider issues subjects that are not UUIDs." Do not paste the token anywhere, and do not decode a token from an app you do not own.
- In your own SQL editor, list the policies on your tables. Select from pg_policies. Look for auth.uid() in policies that serve these provider users. If sub is not a UUID, that page says auth.uid() fails, and the sample reads (select auth.jwt()->>'sub') into a text user_id column. If you use more than one issuer, or you also use Supabase Auth, confirm a restrictive policy checks iss. That page says: "Your project trusts every issuer you add, and sub values from different issuers can collide." It says "make sure you don't omit the as restrictive clause." Do not run this in a project you do not own.
- Signed in through the provider in your own app, load a page that reads your own rows. You should see only your rows. Signed out, the same request should return none. That page says a request with no role claim runs as the anon role, and the sample owner policy is written to authenticated. That page does not name an error message for the anon case. Do not point this check at another project, and do not print row contents.
Common questions
My user is signed in. Why does the list come back empty?
The token Supabase received can be missing a role claim. The Supabase docs page "Custom OIDC provider" says: "Without a role claim, requests run as the anon role." The sample policy on that page that reads a user's own rows is written to authenticated. A request running as the anon role does not match a policy written to authenticated, so the list looks empty, or the query returns a permission error, as if the user were signed out. That page does not name an error message for the anon case. It says: "Set role to authenticated for signed-in users." It says: "Use your provider's custom claims or token template feature to add it." The client on that page passes the provider's JWT through accessToken. That function returns the provider's JWT, or null if nobody is signed in.
The policy uses auth.uid(). Why does that fail?
The Supabase docs page "Custom OIDC provider" says: "The sub claim identifies the user. auth.uid() casts sub to uuid, so it fails if your provider issues subjects that are not UUIDs." sub is the user id in the token. The page says the cast fails. It does not name a longer error. It says to read the claim directly. The sample policy is to authenticated, using (user_id = (select auth.jwt()->>'sub')), and user_id must be a text column. If your provider's sub is a UUID, that page does not say to stop using auth.uid().
The rows show up. Can two issuers share the same user id?
Yes. The Supabase docs page "Custom OIDC provider" says: "Your project trusts every issuer you add, and sub values from different issuers can collide." If you use more than one issuer, or you also use Supabase Auth, that page says to add a restrictive policy that checks the iss claim, and it says "make sure you don't omit the as restrictive clause." iss is the issuer address inside the token. The Supabase docs page "Third-party auth" says: "It is not possible to disable Supabase Auth at this time." That page also says the signing keys are checked for changes periodically, and: "If you are rotating your keys (when supported) allow up to 30 minutes for the change to be picked up." A wait after key rotation is not the empty list from a missing role claim.