auth-js icon indicating copy to clipboard operation
auth-js copied to clipboard

setAuth() is not returning { user, error } when called server side

Open robinscholz opened this issue 3 years ago • 1 comments

Bug report

Describe the bug

It seems like the documentation for setAuth() is wrong. The express example shows { user, error } as the returned object. However, it seems like this is not implemented: https://github.com/supabase/gotrue-js/blob/edcd2ffde6dfe81d02700a52a79e635a5ab8839d/src/GoTrueClient.ts#L389

As far as I understand it, this is what is used for server side calls, correct?

Expected behavior

Return { user, error } as documented, also server side.

System information

  • OS: macOS
  • Version of supabase-js: v16.1.0^1.31.1
  • Version of Node.js: v16.1.0

robinscholz avatar Mar 18 '22 13:03 robinscholz

Yes, you're correct. Not sure when the docs will reflect this - or if there are plans to include error in the returned object, but you can contribute to the docs if you'd like - https://github.com/supabase/supabase/blob/master/DEVELOPERS.md

On the server-side, it returns an object with access_token: with a value of whatever you provided it, token_type: bearer, and user: null.

Only on the client-side does it return this info, plus info for the user associated with the token and the current session.

j4w8n avatar Jun 01 '22 23:06 j4w8n

There has been a lot of changes with respect to server side rendering in v2 of the library, which should address this issue.

hf avatar Dec 30 '22 19:12 hf