Jason Creviston
08/30/2022, 5:21 PMTOKEN_REFRESHED
event?
I'm getting several of them shortly after an OAuth login. Not only that, but localStorage never updates with the new access and refresh tokens. In the supabase gui, the original refresh token is revoked.
Inside onAuthStateChange()
, I console.log(event, session?.refresh_token)
This is the output from my last login. I'm using the v2 release candidate.
SIGNED_IN nLwJt-yoM2VWVS7bG9p3XA
TOKEN_REFRESHED
TOKEN_REFRESHED
TOKEN_REFRESHED
TOKEN_REFRESHED
TOKEN_REFRESHED
TOKEN_REFRESHED
TOKEN_REFRESHED
TOKEN_REFRESHED
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
TOKEN_REFRESHED K60dOCv-wgFTh47r8F1Igw
connection01
08/30/2022, 5:21 PMDatabase Webhook
on auth.users
?olegkorol
08/30/2022, 5:26 PMjavascript
import { supabaseClient } from '@supabase/auth-helpers-nextjs' // version 0.2.7
// [...]
useEffect(() => {
const subscription = supabaseClient
.from('TABLE_NAME')
.on('*', async (payload) => {
// do something...
}
)
.subscribe()
return () => { supabaseClient.removeSubscription(subscription)
};
}, []);
// [...]
If I try to apply a simple RLS policy, like the following, the subscription above does not work anymore:
sql
CREATE POLICY "TEST_POLICY" ON "public"."TABLE_NAME"
AS PERMISSIVE FOR ALL
TO public
USING (auth.uid() = user_id)
WITH CHECK (auth.uid() = user_id)
Any ideas?매튜
08/30/2022, 6:14 PMLogicpoints
08/30/2022, 7:05 PMrole
table with id
and name
* role_user_assignment
table with role_id
, user_id
to give a user a role
* role_channel_permission
table with permission
enum "react" "reply_in_thread"
and pointer to channel_id
, role_id
to give users of a certain role a permission in a certain channel.
So for example to check if user can create a reaction to a message in a channel... I'd have role named "Reactors" with an assignment to a user, and there'd be a role_channel_permission for permission to "react" on Reactors role_id in a given channel.
Then the question is how to model the row level security for this?
I want to only allow insertion of the message_reaction
on a message for users who have a role that has a role_channel_permission in the given channel to "react"
.
Anyone have any examples of these "nested access policies with joins"?
Otherwise I know i could just write supabase functions to do this but it seems like something I could model with access policies...Logicpoints
08/30/2022, 7:13 PMDeleted User
08/30/2022, 7:36 PMconnection01
08/30/2022, 7:47 PMpsql -d $NEW_DB_URL -U postgres -f dump.sql
psql: error: connection to server at "db.xxxxxxxxxxxxxx.supabase.co" (3.88.156.105), port 6543 failed: FATAL: SASL authentication failed
connection to server at "db.xxxxxxxxxxxxxx.supabase.co" (3.88.156.105), port 6543 failed: FATAL: SASL authentication failed
wieli99
08/30/2022, 9:16 PMUlriken
08/30/2022, 10:14 PMsupabaseClient.auth.signIn({email, password})
And then when I do supabaseClient.auth.session()
on the server upon page request, I get the session. However, there is no cookie or local storage set on the browser.
Then when I visit my dev server's address on another browser (Safari) and I get the session. I even get the session on incognito mode.
So, how does this actually work? I don't even pass anything to supabaseClient.auth.session()
This must be coming from the supabase server, but then how can I sign-in multiple users? I am a bit confusedjxyz
08/30/2022, 10:20 PMAnddy
08/30/2022, 10:38 PMjs
useEffect(() => {
async function loadProfile() {
const { id, created_at, user_id, username, karma, avatar } =
await getProfile();
setProfile({ id, created_at, user_id, username, karma, avatar });
await client
.from('*')
.on('*', async (payload) => {
const { id, created_at, user_id, username, karma, avatar } = await getProfile();
setProfile({id, created_at, user_id, username, karma, avatar});
})
.subscribe();
}
loadProfile();
}, [profile]);
SchneckchenAndy
08/31/2022, 12:01 AMLight
08/31/2022, 12:22 AMproduct_id text references products
await supabase
.from('products')
.select('*, prices(*)')
When I try this query it says Could not find a relationship between 'products' and 'prices' in the schema cache
I am doing this join correctly?jon.m
08/31/2022, 1:09 AMAris Ripandi
08/31/2022, 1:23 AMcreated_at
column to be updated.
If possible, can anyone give me an example?
Thanks.subwaymatch
08/31/2022, 2:12 AMfernandops26
08/31/2022, 2:14 AMchientrm
08/31/2022, 2:15 AMselect
there's no error. However, if I use select
right after a upsert
. This error occurBorisdm
08/31/2022, 3:42 AMluke90275
08/31/2022, 3:52 AMIsological
08/31/2022, 4:46 AMak4zh
08/31/2022, 5:47 AMEXEUTE function do_something(SELECT project_ref_id FROM some_table)
Fainaru
08/31/2022, 5:57 AMfelixthehat
08/31/2022, 10:16 AMrestaurants
with metadata (name, address etc) and a table called reviews
– I'd like when I query the restaurants
table to pull in relevant reviews
. In which table should I add a foreign key column? Both? Should the reviews
table have a foreign key column with the restaurant ID in it? Bit confused on the best approach, thanks! Note – I only plan one review/row per restaurant if that helpsShaf
08/31/2022, 10:57 AMJTmaveryk
08/31/2022, 12:17 PMpsteinroe
08/31/2022, 12:55 PMKTibow
08/31/2022, 3:36 PMSUBSCRIPTION_ERROR
with { reason: ":error" }
. What does this mean? What can I do to debug?