mellson
06/16/2022, 11:22 AMweilzuvielgewalt
06/16/2022, 11:44 AMSagieq
06/16/2022, 11:55 AMBearer ${config.SUPABASE_KEY}
,
'Content-Type': 'application/json',
'Accept': 'application/json',
}
})
I really appreciate the help 🙂cooper
06/16/2022, 3:48 PMhemantgangolia
06/16/2022, 5:13 PMngs
06/16/2022, 6:19 PM{ data, error } = await supabase.auth.update({ password: "password" });
workflow throws a 401 (Unauthorized) Password update requires reauthentication
error.
My function is dead simple:
const updatePassword = async () => {
try {
const { user, error } = await supabase.auth.update({
password: "password"
});
if (error) throw error;
updateMessage = `Password updated: ${new Date()}`;
} catch (error: any) {
updateMessage = `${error.error_description || error.message}`;
} finally {
loading = false;
}
};
The same approach is successful for updating email (triggers the 2 step confirmation path) and metadata.
I've also tried using the supabase.auth.api.updateUser(accessToken, {password: 'password'})
, which returns the same error.
Additional wrinkle: supabase.auth.update()
doesn't return the error when passed password: undefined
. And it successfully updates metadata when the payload is: { password: undefined, data: { hello: 'world' } }
TobTobXX
06/16/2022, 8:38 PMdbristow
06/16/2022, 8:42 PMpoutingemoji
06/16/2022, 11:41 PMunexpected response from login query
error. any ideas on what the problem may be?liljamesjohn
06/17/2022, 12:38 AMFED
06/17/2022, 1:46 AMfarzad
06/17/2022, 2:47 AMThe input string ended unexpectedly / invalid input syntax for type json
my payload
{
"completed": false,
"prizes": [],
"type": "daily",
"url": "https://youtu.be/6Ypk95FaOFQ",
"createdBy": "910b7452-7532-4ee2-9168-334bf6123cd6"
}
farzad
06/17/2022, 2:58 AMfarzad
06/17/2022, 3:05 AMmessage":"Error in $: not enough input
not sure what to do here when i havent updated the supabase dependency, or any other code 😒beepboop
06/17/2022, 4:48 AMjs
export const supabase = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY)
const { data, error } = await supabase.from('profiles').select('*').eq('id', userId).maybeSingle()
// const { data, error } = await supabase.from('profiles').select('*').eq('id', userId).limit(1).single() // works when RLS disabled
// const { data, error } = await supabase.from('profiles').select('*').eq('id', userId).single() // works when RLS disabled
Response before RLS
js
{
"id": "123-123-1241-1231",
"created_at": "2022-06-10T03:59:22.751125+00:00",
"is_subscribed": false,
"interval": null,
"email": "scott.tj.yu@gmail.com"
}
Response after turning on RLS
js
{
"message": "JSON object requested, multiple (or no) rows returned",
"details": "Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row"
}
I've tried schema reload, re-implement the policy, but none's been working so far.
I have a "profile" table its "id" column referencing the "auth.users.id".
The policy's target role is currently "anon" but I've tried "authenticated" as well.
(uid() = id)
I also tried to change the table name to "profiles" (plural) instead of "profile" but no luck.omar
06/17/2022, 6:18 AMuser
, therapy sessions
? would that be a m2m
relationship? I'd like to maybe show a history
timeline for user interactions. Is that a separate table with user_id
session_id
?Dembe
06/17/2022, 9:30 AMlyqht
06/17/2022, 10:13 AMjonesy-dev
06/17/2022, 10:14 AMDembe
06/17/2022, 10:53 AMconst avatarFile = event.target.files[0]
const { data, error } = await supabase
.storage
.from('avatars')
.upload('public/avatar1.png', avatarFile, {
cacheControl: '3600',
upsert: false
})
I have a path like
categories/sport/football,
Do i need to have public first, then categores/sport/fotboll? Or does it work, because when i upload now, i get error, but when i added public before i didnt get an error but it still uploads in both ways.Shoki
06/17/2022, 11:29 AM[Unhandled promise rejection: Error: You must provide a OpenID Connect provider with your id token and nonce.]
Here is the code:
js
const { error } = await supabase.auth.signIn({
oidc: {
id_token: googleAuthSession.idToken!,
provider: "google",
nonce: "",
},
});
i am passing provider, so why is it complaining ?Lior539
06/17/2022, 1:26 PMusers
table. A user has an id
field (foreign key on auth.oid()
) and also a company_id
I want to write a RLP such that a user can select the row for any other user provided they are in the same company (i.e have the same company_id
)
I wrote the following statement, but the problem is that I get an infinite recursion error (which makes sense). Anyone know how I would be able to achieve my desired RLP?
(id = uid()) OR (company_id = ( SELECT users_1.company_id
FROM users users_1
WHERE (users_1.id = uid())
LIMIT 1)))
TobTobXX
06/17/2022, 1:48 PMalter table "your_table" replica identity full;
is not the one I'm looking for. The docs on .on().subscribe()
mention I can turn it on by [managing replication](https://supabase.com/docs/guides/api#managing-realtime), but that link (more specifically the anchor to this section) doesn't exist. Did the docs change?Nditah
06/17/2022, 2:17 PMJoão Vitor
06/17/2022, 2:31 PMsql
BEGIN
IF NOT EXISTS(SELECT 1 FROM cart WHERE user_id = auth.uid()) THEN
INSERT INTO cart (user_id, total) VALUES (auth.uid(), 0);
INSERT INTO cart_item (cart_id, product_id, user_id, quantity)
VALUES (
new.id,
new_product_id,
auth.uid(),
new_quantity
);
ELSE
UPDATE cart SET total = old.total + new_quantity * (SELECT price FROM product WHERE id = new_product_id)
WHERE user_id = auth.uid();
UPDATE cart_item
SET quantity = old.quantity + new_quantity
WHERE product_id = new_product_id AND user_id = auth.uid();
END IF;
RETURN new;
END;
trebor
06/17/2022, 2:35 PMHero
06/17/2022, 5:17 PMvikstack
06/17/2022, 5:25 PMhttps://my_supabase_url/storage/v1/object/public/public-bucket/public/bbWh0lmuRQlzS64.mp4
- this is the link given by supabase, its called publicUrl, idk why but when I open it, it does a 404 page 😦tg44
06/17/2022, 5:36 PMbhaskar
06/17/2022, 7:10 PM