STILLWATER;
09/24/2022, 1:22 PMgustavoeliasexe
09/24/2022, 2:40 PMmbr
09/24/2022, 2:43 PMauth.signUp
in the JS SDK?mbr
09/24/2022, 3:17 PM/settings
endpoint of GoTrue via curl
.
Is there a list for these routes?sofaking
09/24/2022, 3:27 PMmbr
09/24/2022, 4:34 PMapiKey
header and one in the Authorization: Bearer ...
header.
Obtaining a user JWT via /auth/v1/magictoken
(which is delivered as a cookie named sb-access-token
?) does not seem to yield a JWT that can be used for both.
Is it correct to place the anonymous JWT into the apiKey
header to bypass an initial gateway, and have the supplied user-JWT be used in the Authorization
header for the actual auth?
What happens when the service_role
JWT is used for apiKey
instead?enyo
09/24/2022, 4:53 PMexport type PresenceState = { [key: string]: Presence[] }
I tried it, and when I open multiple windows, it just adds a new entry in the PresenceState
Object, so why is there a list of Presence[]
for each key?Kruger
09/24/2022, 5:02 PMreturn supabase
.from('table1')
.select(`*`)
.eq('account', account)
on one function call, but then:
return supabase
.from('table1')
.select(`*`)
.eq('account', account)
.eq('2ndThing', 2ndThing)
Can I toggle on/off that last eq or do I need to define a separate function?Dil
09/24/2022, 5:15 PMMatt
09/24/2022, 5:47 PMkingpeppe
09/24/2022, 5:56 PMjs
const getCoingeckoData = async () => {
const { data: tokens, error } = await supabase.from('tokens').select('*');
const ids = tokens.map((token) => token.coingecko_id);
console.log(ids); \\ [ 'kounotori', null, 'shield-protocol-token', 'saitama-inu' ]
const { data: price } = await CoinGeckoClient.simple.price({
ids: ids,
vs_currencies: 'usd,eth',
include_market_cap: true,
include_24hr_vol: true,
include_24hr_change: true,
include_last_updated_at: false
});
ids.forEach(async (id) => {
const { data, error } = await supabase.from('tokens')
.update({
usd: formatCurrency(price[id].usd, 'usd', 'en'),
eth: formatCurrency(price[id].eth, 'eth', 'en').substring(1)
}).eq('coingecko_id', id);
});
};
rgfx
09/24/2022, 6:43 PMjs
const testFunction = async () => {
let userId
supabase.auth.onAuthStateChange((event, session) => {
if (event == 'SIGNED_IN'){
userId = session.user.id;
console.log("auth state has changed", userId);
}
});
return userId;
};
console.log('id',await testFunction());
joshua7v
09/24/2022, 6:50 PMsudoramen
09/24/2022, 11:03 PMsupabase/tables/table_name.sql
. To add this table in my DB, I run a new migration with the line \i supabase/tables/table_name.sql
but I'm getting Error: Error starting database: supabase/tables/table_name.sql: No such file or directory
when I try to spin up Supabase.
Two questions,
1. What is the relative path when running supabase start
? Maybe I just have the wrong path in my migration script.
2. Is there a better way I could be organizing my scripts/migrations?
Thanks for any help!Nicola
09/25/2022, 12:13 AMBlobby
09/25/2022, 1:56 AMexport async function getProspectFileList(): Promise<any> {
const { data, error } = await supabaseClient.storage
.from('prospects')
.list();
if (error) return error.message;
console.log("got the data", data);
return data;
}
this returns an empty array. but I see files in the prospects
bucket. any ideas?jdgamble555
09/25/2022, 2:34 AMusers
- id
- ...
posts
- id
- author (fk to users.id)
- ...
likes
- pid (fk to posts.id)
- uid (fk to users.id)
(PK = pid + uid)
And I'm trying to create a universal policy where users can like their own posts (CRUD), but this doesn't work:
sql
(role() = 'authenticated'::text) AND (uid = uid() AND pid.author = uid())
I get this error:
Error adding policy: failed to create pg.policies: missing FROM-clause entry for table "pid"
This seems pretty basic, but my mind keeps exploding right now.
Jstevharve
09/25/2022, 2:52 AMbhaskar
09/25/2022, 3:51 AM((()))
09/25/2022, 3:55 AMjs
userDetails() {
return supabase
.from('muni_users')
.select('*')
.eq('user_id', supabase.auth.user().id);
},
on a page
js
export async function load() {
const { data: muni_user, error: bleh } = await db.users.userDetails();
console.log(muni_user)
};
and this is error I get in terminal while my browser shows ERROR 500
text
Cannot read properties of null (reading 'id')
TypeError: Cannot read properties of null (reading 'id')
What is causing it and how can I pass currently logged in user id to userDetails()? If I hardcode user id which is uuid for that table then it shows me results I am looking for.The Little Cousin
09/25/2022, 4:39 AMrinorzk
09/25/2022, 4:47 AMbegin
insert into public.profiles (id, username, avatar_url)
values (new.id, new.raw_user_meta_data->>'username', new.raw_user_meta_data->>'avatar_url');
return new;
end;
MrPoule
09/25/2022, 8:08 AMmagicbyt3
09/25/2022, 10:13 AMjdgamble555
09/25/2022, 12:47 PM0xdunston
09/25/2022, 11:22 AM{
code: '42883',
details: null,
hint: 'No operator matches the given name and argument types. You might need to add explicit type casts.',
message: 'operator does not exist: text = bigint'
}
this used to work fine before:
let { data, error } = await supabase
.from('new-follows')
.select('username,follow_by,twit_id')
.eq('follow_by', 239518063);
but now this gives the error above:
let { data, error } = await supabase
.from('new-follows')
.select('username,follow_by,twit_id')
.eq('follow_by', '239518063');
avalanche
09/25/2022, 11:33 AMliljamesjohn
09/25/2022, 12:29 PMaccounts
so that a user can only access it if they are a account manager
.
I also have a published_status
table, which I only want to allow account managers
to have access.
How would this be done?0xAsimetriq
09/25/2022, 12:36 PM{{ .Token }}
2. I tried using both type: 'magiclink'
and type: 'signup'
in code below
3. My email provider settings are set to 60000
for expiry seconds and 6
for password length. Email confirmation is set to be enabled.
Implementation is as follows
ts
const { data, error } = await supabaseClient.auth.signInWithOtp({ email })
// {"data": {"session": null, "user": null}, "error": null}
const { data, error } = await supabaseClient.auth.verifyOtp({ email, token, type: 'signup' })
// {"data": {"session": null, "user": null}, "error": [AuthApiError: Token has expired or is invalid]}
I double verified that token I am sending is exact one as I got in email, yet I keep getting that auth error.Haus Of Alejandro
09/25/2022, 12:58 PM