Bug with supabase.auth.getSessionFromUrl();
Bug report
Describe the bug
When i authenticate with google the user gets authenticated and i get their credentials through supabase.auth.user(), but i can't get the user object with the supabase.auth.getSessionfromUrl function.
This bug only exists if you don't add the { storeSession: true } option in the supabase.auth.getSessionFromUrl function.
To Reproduce
This is the function thats called signIn
export const signIn = () =>
supabase.auth.signIn(
{ provider: 'google' },
{ redirectTo: 'http://localhost:3000/auth/callback' }
);
I just use this function at a button press like this
import {signIn} from "@core/auth";
export default function PageComponent() {
....
return (
<>
<button onClick={signIn}>
Sign in
</button>
...
</>
)
}
When its redirected to the /auth/callback route. I call this function
await supabase.auth.getSessionFromUrl();
And then this response
{
"data": null,
"error": {
"message": "TypeError: Cannot read properties of undefined (reading 'api')",
"stack": "TypeError: Cannot read properties of undefined (reading 'api')
at GoTrueClient.js:320:39
at Generator.next (<anonymous>)
at GoTrueClient.js:7:1
at new Promise (<anonymous>)
at __awaiter (GoTrueClient.js:3:1)
at getSessionFromUrl (GoTrueClient.js:298:1)
at _callee$ (callback.tsx:10:40)
at tryCatch (runtime.js:63:16)
at Generator.invoke [as _invoke] (runtime.js:293:1)
at Generator.next (runtime.js:118:1)"}
}
Expected behavior
What i want it to do is to redirect to the google auth page sign in, and then give me the credentials in the method:
supabase.auth.getSessionFromUrl(); // <-- this
This method is in the /auth/callback route, but for some reason i get this error
{
"data": null,
"error": {
"message": "TypeError: Cannot read properties of undefined (reading 'api')",
"stack": "TypeError: Cannot read properties of undefined (reading 'api')
at GoTrueClient.js:320:39
at Generator.next (<anonymous>)
at GoTrueClient.js:7:1
at new Promise (<anonymous>)
at __awaiter (GoTrueClient.js:3:1)
at getSessionFromUrl (GoTrueClient.js:298:1)
at _callee$ (callback.tsx:10:40)
at tryCatch (runtime.js:63:16)
at Generator.invoke [as _invoke] (runtime.js:293:1)
at Generator.next (runtime.js:118:1)"}
}
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: Windows 11
- Browser Brave browser
- Version of supabase-js: 1.29.4
- Version of Node.js: 16.13.1
Update?
Closing for lack of activity and I think this has already been taken care of with the release of v2.