-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
supabase.auth.signUp() with metadata returns nil User, even if result successful #172
Comments
Hey @marcusraty From the print output you pasted, it contains a session and not a nil value as you mentioned. The Here is an example on how you should use it: let response = try await client.signUp(email: "email", password: "password")
switch response {
case let .session(session):
// User created, and doesn't require email confirmation, so a Session was already returned.
case let .user(user):
// User created but requires email confirmation.
} I hope this helps, if you still face any issues, let me know. Thank you. |
Thanks for your reply! The following code shows a valid session but a nil user:
I would expect both the result and user to have valid values, because I have turned off email confirmation in my supabase. Running your switch code and printing out the session/user - only shows a user. I was running this code before using Note: my code also have an auth listener |
Thank you @marcusraty, here is a fix for it #174, I'll make a new release once it gets merged. Thanks again. |
Bug report
supabase.auth.signUp()
Describe the bug
I was previously using supabase.auth.signUp() successfully, but have added a trigger to the auth table, I am sending metadata in supabase.auth.signUp() now and using this in my trigger. I have confirm email turned off.
supabase.auth.signUp() returns (ie does not throw an error). In my dashboard I can see the new user in my auth table, and I can see the new row in my public.profiles which was the result of my trigger.
Printing the result seems to show a User as well, unless I am mistaken! However when I attempt to unwrap this and get the user, it returns nil.
`result is session(GoTrue.Session(providerToken: nil, providerRefreshToken: nil, accessToken: REMOVED", tokenType: "bearer", expiresIn: 3600.0, refreshToken: "REMOVED", user: GoTrue.User(id: REMOVED, appMetadata: ["providers": _Helpers.AnyJSON.array([_Helpers.AnyJSON.string("email")]), "provider": _Helpers.AnyJSON.string("email")], userMetadata: ["isPublic": _Helpers.AnyJSON.bool(true), "username": _Helpers.AnyJSON.string("marcusroar"), "dateOfBirth": _Helpers.AnyJSON.string("2004-12-05")], aud: "authenticated", confirmationSentAt: nil, recoverySentAt: nil, emailChangeSentAt: nil, newEmail: nil, invitedAt: nil, actionLink: nil, email: Optional("REMOVED"), phone: Optional(""), createdAt: 2023-12-05 06:52:23 +0000, confirmedAt: nil, emailConfirmedAt: Optional(2023-12-05 06:52:23 +0000), phoneConfirmedAt: nil, lastSignInAt: Optional(2023-12-05 06:52:23 +0000), role: Optional("authenticated"), updatedAt: 2023-12-05 06:52:23 +0000, identities: Optional([GoTrue.UserIdentity(id: "df71ad62-ef45-4025-b2f6-282744d2938d", userId: DF71AD62-EF45-4025-B2F6-282744D2938D, identityData: Optional(["email": _Helpers.AnyJSON.string("[email protected]"), "email_verified": _Helpers.AnyJSON.bool(false), "sub": _Helpers.AnyJSON.string("df71ad62-ef45-4025-b2f6-282744d2938d"), "phone_verified": _Helpers.AnyJSON.bool(false)]), provider: "email", createdAt: 2023-12-05 06:52:23 +0000, lastSignInAt: 2023-12-05 06:52:23 +0000, updatedAt: 2023-12-05 06:52:23 +0000)]), factors: nil)))
`
Expected behavior
If supabase.auth.signUp() is successful both User and Session should be returned
Additional context
Happy to provide any additional details - thanks!
The text was updated successfully, but these errors were encountered: