question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setAuth() function missing in supabase-js v2

See original GitHub issue

Bug report

setAuth() function is missing in the supabase-js v2 RC.

Describe the bug

setAuth() function is missing in the supabase-js v2 RC.

To Reproduce

Going through the functions & docs, there are no mentions of this function being removed. It throws an error because it’s not a defined function.

Expected behavior

Expecting that supabaseClient.auth.setAuth(cookie) to be an available function.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: macOS
  • Version of supabase-js: 2.0.0@rc
  • Version of Node.js: 17.2

Additional context

This function is necessary since it can be used to perform SSR pre-fetching with the user’s credentials.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
catlancommented, Sep 24, 2022
        Authotization: `Bearer ${accessToken}`,

There is a typo, should be Authorization.

2reactions
bhvngtcommented, Aug 23, 2022

I have been using setAuth in my test suite. This change has broken quiet a few of my test cases. While I could substitute setAuth with global Authorization header for some of my test cases, there are cases that I could not fix it.

  • previously setAuth would trigger onAuthStateChange handler with TOKEN_REFRESH event. With current solution of creating createClient with global Authorization header, such events does not appear to be getting triggered.

  • How does one set realtime client with authorization token. As per my limited understanding, realtime auth gets triggered on authStateChange event. However, setAuth expects channels to be already added to the channel list. So does that mean that I need to subscribe to the channels before I authenticate users. In such a scenario how does one deal with node-side testing of realtime-client RLS test cases

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release Notes | Supabase
Supabase.js v2 release notes. ... We're removing the signIn() method in favor of more explicit function signatures: ... Deprecated and removed setAuth() ....
Read more >
supabase.auth.api.getUserByCookie() doesn't work in Next.JS ...
I'm trying to use supabase.auth.api.getUserByCookie() in getServerSideProps and the user is always null. export async function ...
Read more >
Get supabase `user` server side in next.js - Stack Overflow
If you need to get the user in server-side, you need to set the Auth Cookie in the server using the given Next.js...
Read more >
Pass Supabase Session Cookie to API Route to Identify User
setAuthCookie. We will create an API route to set a Supabase auth cookie. ... we can use the getUserByCookie function to get the...
Read more >
How to Build a TodoApp using ReactJS, NextJS, and Supabase
Before we begin, you should be familiar with the basics of React.js and Next.js to get the most out of this guide. If...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found