-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AuthApiError: invalid claim: missing sub claim #641
Comments
I can't reproduce the malformed credential. I'm using OAuth instead of email/pass; but I'd assume a JWT is created with the same code, no matter which is used. As for const { data, error } = await client.auth.setSession({ access_token: 'value', refresh_token: 'value' }) |
After following this example from the Having upgraded to Next 13 seemed to be the root cause of this issue as now I can see that the I think it's safe to close this bug report as it relates to using |
I am having the same issue. But I am not in NextJS-land. I am working on a server-side Solid Start solution, using cookies. Having said that the reproducing sample is just about identical. The only difference is that I am getting the access_token and refresh_token from a cookie. The weird thing is that the The error comes from the A few days ago when I started working on the code, it was working too (AFAICT). I first then started to see this a few times and now it is there every time. Is it necessary to even call getUser? The samples all show the setSession call without using the returned data, which includes the user. Can't I just use the user returned? In this app I am not exposing the supabase-client at all in the browser. All the code is run server-side. I am creating a secure cookie that contains the access and refresh tokens (encrypted). So, every request from the client to the server will pass that cookie and I will then be able to authenticate the user (via Should I then update the refresh-token in my cookie after the call, if it has changed? As I believe that it may have been rotated - and I guess it should not be reused. |
Although, I haven't tried to actually do anything after the |
Not sure if this is a perfect solution, but I made some option-changes to the call to
It seems that after I added |
Yeah, there's no good docs on this. For |
No problem @soedirgo. What I said is only true if you don't pass an access token into getUser. Because in that case, it calls getSession; which is where things really breakdown. Gary opened an issue about it supabase/auth-js#539 There are also issues with using setSession on the server side without setting persistSession to false. Not because of that method's direct code, but because it calls |
I have also added passing the |
Yep, that's a good way to do it on the server side. |
I was getting this error because I have an Express backend and want to attach the user object in Express middleware. I am passing the accessToken / refreshToken via the serverSideRendering docs. In the middlware, I was calling
Adding this flag (as referenced above) seems to have fixed it:
|
I am experiecing this issue too. I have an nx.dev monorepo with an SPA in React sporting Vite and an express app for backend stuff (both will go inside Tauri app). Before I landed on the Could it be that the underlying issue is in Supabasejs not communicating properly with server-based build frameworks? This library is using Since Supabasejs is isomorphic the solution could be in polyfilling I have no idea if any of this applies to |
I ran into this issue tonight, getting I'm doing something similar to what was mentioned above with a client that logs in via Supabase, then sends the access/refresh tokens to a separate server. The problem for me was that const supabaseUserClient = createClient(supabaseUrl, supabasePublicKey, {
auth: {
autoRefreshToken: false,
persistSession: false,
},
});
// you have to `await` this promise for the session to actually be set!
await supabaseUserClient.auth.setSession({
access_token: accessToken,
refresh_token: refreshToken,
});
return supabaseUserClient; |
I'm having that issue using supabase with expo. |
I'd recommend opening your own issue. This one is pretty stale. You can also ask on the Discord server. |
I also encounter this problem, set persistSession to false not works for me, and also this answer link is dead, so this problem is not resolved for me. Is this isssue answered somewhere or is it not fix yet? |
I'm not 100% sure I understand your problem but have you tried the solution from my comment in another issue: |
Too bad to see that this error still exists. How do we get around this? 🤔 |
Any workarounds? Using supabase on both server and client log-outs users from time to time, really annoying :( @awalias can we please reopen this issue since the error still occurs? |
Same issue here on Safari, working fine on Chrome. |
@awalias why is this closed please? This is a persistent issue. |
I think worth opening a new issue and linking to it from here so other folks coming from Google find their way |
The same just happened to me with a Next.js app running in Safari for days in the background. For some reason that I haven't figured out yet, there was an infinite loop that kept calling According to my Auth logs, those calls stopped once I closed Safari. The network tab in Safari didn't list any of these calls though. So I suspect that there was something going back and forth between the client and my server which issued the calls to the Supabase API. |
Bug report
Describe the bug
Credentials are malformed are not being stored properly and therefore the client is not able to lately resolve the session
After calling
supabase.auth.signInWithPassword({email, password})
this strangely formatted token is generatedAnd later on, doing
await supabase.auth.setSession(token);
throws the following error:This is the versions that I'm currently using:
This worked before with versions:
And I have my product live without issues https://otpfy.com, but after upgrading everything to latest, it stopped working as expected 🤔
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
I'm using
next
for everything relatedSign in a user server-side
Try to see if the user is authenticated after server-side:
Expected behavior
I should be able to sign up a user and work fine as expected
System information
The text was updated successfully, but these errors were encountered: