Cheqo
08/26/2022, 4:12 PMDeadlyDev
08/26/2022, 4:19 PMVincent Warmerdam
08/26/2022, 4:25 PM<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>
email
<input type="text" id="email">
<button onclick="signInWithEmail()">signin</button>
<script>
const SUPABASE_KEY = 'xxx'
const SUPABASE_URL = "yyy"
const client = supabase.createClient(SUPABASE_URL, SUPABASE_KEY);
async function signInWithEmail() {
console.log(`Trying to log in ${document.getElementById("email").value}`)
const { user, error } = await client.auth.signIn({
email: document.getElementById("email").value
})
console.log(user);
console.log(error);
}
</script>
This is hosted on localhost:8000 and supabase is configured to send a magic link with a re-direct. The redirect works ... I briefly see extra info in the URL, but how does the user actually get authenticated? The docs (https://supabase.com/docs/guides/auth/auth-magic-link) suggest that I merely need to call .auth.signIn
but that's the same method that I used to send the email?
Is there an example of basic email authentication that uses vanilla JS with supabase hosted via CDN.luke90275
08/26/2022, 4:38 PMRyanHirsch
08/26/2022, 7:30 PMwieli99
08/26/2022, 7:33 PMSeñor Bruno
08/26/2022, 10:11 PMtype profiles {
birthday: Date
can_be_roommate: Boolean
created_at: Datetime
description: String
display_name: String!
employment: Int
first_name: String!
id: BigInt!
last_name: String!
search_as: Int
tenant_attributes: [Int]
user_id: UUID!
}
But its mutation type is missing the tenant_attributes
input profilesUpdateInput {
birthday: Date
can_be_roommate: Boolean
created_at: Datetime
description: String
display_name: String
employment: Int
first_name: String
last_name: String
search_as: Int
user_id: UUID
}
Error:
× GraphQL Document Validation failed with 1 errors;
Error 0: GraphQLDocumentError: Field "tenant_attributes" is not defined by type "profilesUpdateInput".jdgamble555
08/26/2022, 11:46 PMsythic
08/26/2022, 11:54 PMexport const getClient = (token?: string): SupabaseClient => {
return createClient(SUPABASE_API_URL, token || SUPABASE_ANON_TOKEN);
};
This doesn't seem to create me a client authorized as that user (token is the JWT from Authorization header)
supabase.auth.user()
is null but tells me I should use auth.api.getUserByCookie()
to do this in the server context. But I'm not using a cookie or any type of session managementFez
08/27/2022, 12:25 AMdeno.json
looks like this:
> {
> "compilerOptions": {
> "allowJs": true,
> "esModuleInterop": true,
> "experimentalDecorators": true,
> "inlineSourceMap": true,
> "isolatedModules": true,
> "jsx": "react",
> "lib": ["deno.window"],
> "module": "esnext",
> "moduleDetection": "force",
> "target": "esnext",
> "useDefineForClassFields": true,
> "strictNullChecks": false,
> "strictFunctionTypes": false,
> "noUncheckedIndexedAccess": true
> }
> }
>NicoNico
08/27/2022, 2:24 AMcreate function hello_world()
returns text
language plpgsql
security definer set search_path = public
as $$
begin
select 'hello world';
end;
$$;
and if so what's the relationship between the parameters defined above via GUI and what we write in the function?robh
08/27/2022, 9:49 AMwieli99
08/27/2022, 11:25 AMsupabase.from("Recipes").select()
Looking at my session from the browser, the access token says I'm an authenticated user ("aud": "authenticated"
). The auth.users
table agrees.
What am I doing wrong here?maija
08/27/2022, 11:59 AMuser
and the session
back, but an error:
{
"data": null,
"user": null,
"session": null,
"error": {
"message": "Request Failed"
}
}
All requests return 200 and I can't find something unusual in the API or Database logs. I am using the ANON key. GET requests to read data work just fine.
Does anyone have an idea, what could have been responsible for this error? Thanks in advance! 🙏FloH
08/27/2022, 12:54 PMsql
create table objectA ( id )
create table objectB ( id, objectA_id references objectA id)
and i to create those types with the swagger codegen: https://pub.dev/packages/swagger_dart_code_generator (please do not mind syntax. the classes have the json serialization annotation correctly)
dart
class ObjectA() {
id,
List<ObjectB> objectBs,
}
class ObjectB() {
id
}
but the codegen is generating smth like this
dart
class ObjectA() {
id,
}
class ObjectB() {
id,
objectA_ID,
}
which means an postgrest call in dart like this wouldn´t work because objectA.fromJson never reads the value ObjectB:
dart
final response = await _supabaseClient
.from('objectA')
.select(
'''
*,
objectB (
*
)
''',
)
.eq('id', id)
.single()
.execute();
final data = response.data as Map<String, dynamic>;
return ObjectA.fromJson(data);
any reccomendations or best practices on how to solve this?mathurah
08/27/2022, 3:26 PMwieli99
08/27/2022, 4:08 PMRecipes
in which I created a column image_id
which is a foreign key to an image id in my public bucket recipe_images
.
I would think that with the js API I could get the image with const { data, error } = await supabase.from("Recipes").select("recipe_images(*)")
.
However this results in Could not find a relationship between 'Recipes' and 'recipe_images' in the schema cache
I can't find the correct way in the docs, does someone know how to do this?Wonie
08/27/2022, 4:33 PMconst supabase = createClient(
'process.env.DB_URL,
process.env.SUPABASE_SECRET_KEY
)
const { data, error } = await supabase
.from('user_tokens')
.insert([{ token_read_key: code, token: session.access_token }])
error: new row violates row-level security policy for table
Any idea why this happens?KTibow
08/27/2022, 5:39 PMjs
supabase
.from("chat")
.select(
`
*,
schoology_users (
name,
profile_picture
)
`
)
I don't want to allow people to view the auth keys for each person anonymously, but the query doesn't work with the anon key once I enable RLS for schoology_users
. What should I do here?
(Also feel free to suggest a better title and/or tags, could be my actual solution would be different from what I think)FunHellion
08/27/2022, 6:11 PMconst data = await supabase.auth.getUser();
Any way to for instance open the discord auth page in another tab of window?PatoGordo
08/27/2022, 8:01 PMfailed to update pg.columns with the given ID: cannot cast type bigint to uuid
how can I fix it?hankg
08/27/2022, 10:33 PMDeleted User
08/27/2022, 10:48 PM.ilike()
), but I want to search by checking if the text starts with the specified string.
Example:
Some names:
- John
- Marry
- Joe
If I search for Jo
, John and Joe should be returned.franco.valdes
08/28/2022, 12:11 AMAaron Me
08/28/2022, 3:20 AMconst { data, error } = await supabase
.from('Contracts')
.insert([
{ some_column: 'someValue', other_column: 'otherValue' },
])
This will throw:
{code:"42501"
message: "new row violates row-level security policy for table \"Contracts\""}
Ofc which it should.
Pls, help.
EDIT:
Using:
"@supabase/supabase-js": "^1.35.6",
"@supabase/ui": "^0.36.5",
& NextJSeunjae
08/28/2022, 9:57 AMmrboutte
08/28/2022, 2:48 PM((bucket_id = 'contract-attachments'::text) AND ((uid())::text = (storage.foldername(name))[2]))
what I'm struggling to figure out at the moment, is how to write a policy that would allow both users to select/download each other attachments. I also wonder if there's a way for me to rearchitect these file paths to make the problem simplerMosh Tempest
08/28/2022, 3:02 PMKristoff95
08/28/2022, 5:32 PM