Terry
11/10/2021, 12:59 PMsilentworks
11/10/2021, 1:01 PMTerry
11/10/2021, 1:02 PMchipilov
11/10/2021, 1:43 PMsilentworks
11/10/2021, 1:46 PMchipilov
11/10/2021, 1:49 PMletourpowerscombine
11/10/2021, 1:52 PMusers
table with a new UUID β but the returned value is null.
let { user, error } = await supabase.auth.signIn({
email: formData.get('email')
})
Is there anyway to return the newly created user's UUID / user object from this function?
(I have turned off "Enable email confirmations" in the auth settings, to make it easier)silentworks
11/10/2021, 2:25 PMchipilov
11/10/2021, 2:51 PMYelloJello
11/10/2021, 4:41 PMThe schema to expose in your API. Tables, views and stored procedures in this schema will get API endpoints.public and storage are protected by default.
The bits in the blog post and the couple sentences in the docs don't do enough either imo
What does it mean by "protected by default"? Does it have something to do with grants?letourpowerscombine
11/10/2021, 4:53 PMprofiles
table when new users are added, including metadata like email address
, name
, website
, all through the initial sign up function. So creating a new user like this:
javascript
const { data, error } = await supabase.auth.signIn(
{ email: localStorage.getItem('email') },
{
data: {
full_name: formData.get('full_name'),
introduction: formData.get('introduction'),
website_url: formData.get('website_url'),
linkedin_url: formData.get('linkedin_url'),
twitter_handle: formData.get('twitter_handle'),
contact_method: formData.get('contact_method')
}
})
And handling it like this:
sql
create function public.handle_new_profile()
returns trigger as $$
begin
insert into public.profiles (user_id, user_email, full_name, introduction, website_url, linkedin_url, twitter_handle, contact_method )
values (new.id, new.email, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'introduction', new.raw_user_meta_data->>'website_url', new.raw_user_meta_data->>'linkedin_url', new.raw_user_meta_data->>'twitter_handle', new.raw_user_meta_data->>'contact_method');
return new;
end;
$$ language plpgsql security definer;
-- trigger the function every time a user is created
create trigger on_auth_user_created
after insert on auth.users
for each row execute procedure public.handle_new_profile();
Currently, new rows in profiles
are created when the function is called β but they only contain the user_id
and user_email
fields, none of the other data.
I feel like this might be some syntax error in the public.handle_new_profile()
function, not receiving the user metadata or int it the right way. Can anybody suggest a troubleshoot/fix?YelloJello
11/10/2021, 5:13 PMadhi256
11/10/2021, 7:12 PMTerry
11/10/2021, 8:14 PMTerry
11/10/2021, 8:15 PM/profile/
I fetch the fields and the blob of json, and template thatt back out as a quiz. Does that sound like a sensible thing to do?silentworks
11/10/2021, 9:34 PMmagicbyt3
11/10/2021, 9:53 PMScott P
11/10/2021, 10:04 PMmagicbyt3
11/10/2021, 10:04 PMVuNguyen
11/11/2021, 9:52 AM-vi
11/11/2021, 9:55 AMVuNguyen
11/11/2021, 9:55 AM-vi
11/11/2021, 9:57 AMVuNguyen
11/11/2021, 9:57 AMVuNguyen
11/11/2021, 9:57 AMVuNguyen
11/11/2021, 9:57 AM-vi
11/11/2021, 9:58 AMMelon Musk
11/11/2021, 10:20 AMMelon Musk
11/11/2021, 10:20 AM