lazerrouge
07/20/2022, 4:34 PMJoshios
07/20/2022, 6:00 PMJoshios
07/20/2022, 6:01 PMJoshios
07/20/2022, 6:01 PMshini
07/20/2022, 6:33 PMshini
07/20/2022, 6:37 PMshini
07/20/2022, 6:40 PMJoshios
07/20/2022, 6:42 PMJoshios
07/20/2022, 6:42 PMJoshios
07/20/2022, 6:42 PMgaryaustin
07/20/2022, 6:55 PMJoshios
07/20/2022, 7:09 PMshini
07/20/2022, 7:14 PMgaryaustin
07/20/2022, 7:25 PMshini
07/20/2022, 7:26 PMshini
07/20/2022, 7:28 PMshini
07/20/2022, 7:29 PMshini
07/20/2022, 7:30 PMgaryaustin
07/20/2022, 7:36 PMrinorzk
07/20/2022, 7:41 PMshini
07/20/2022, 7:41 PMgaryaustin
07/20/2022, 7:56 PMYeehawlerz101
07/20/2022, 11:53 PMawait supabase.auth.api.inviteUserByEmail(email)
to work with the service_role
. But I have no idea where the service role goes or how to make it actually work properly so for future seekers of this PostHog Actually has some docs on how it works (in thread)kr4b5
07/21/2022, 3:40 PMkr4b5
07/21/2022, 3:40 PMimport { Injectable } from '@angular/core';
import {AuthChangeEvent, createClient, Session, SupabaseClient} from '@supabase/supabase-js';
import { environment } from 'src/environments/environment';
export interface IUser {
username: string;
email: string;
}
@Injectable({
providedIn: 'root'
})
export class AuthService {
private supabase: SupabaseClient;
constructor() {
this.supabase = createClient(environment.supabaseUrl, environment.supabaseKey);
}
get user() {
return this.supabase.auth.user();
}
get session() {
return this.supabase.auth.session();
}
get profile() {
return this.supabase
.from('profiles')
.select(`username, email`)
.eq('id', this.user?.id)
.single();
}
authChanges(callback: (event: AuthChangeEvent, session: Session | null) => void) {
return this.supabase.auth.onAuthStateChange(callback);
}
signIn(email: string, password: string) {
return this.supabase.auth.signIn({ "email": email, "password": password });
}
signUp(email: string, password: string) {
return this.supabase.auth.signUp({ email, password })
}
signOut() {
return this.supabase.auth.signOut();
}
updateProfile(profile: IUser) {
const update = {
...profile,
id: this.user?.id,
updated_at: new Date()
}
return this.supabase.from('profiles').upsert(update, {
returning: 'minimal',
});
}
downLoadImage(path: string) {
return this.supabase.storage.from('avatars').download(path);
}
uploadAvatar(filePath: string, file: File) {
return this.supabase.storage
.from('avatars')
.upload(filePath, file);
}
}
kr4b5
07/21/2022, 3:41 PMhandleLogin(mail: string, pw: string) {
this.loading = true;
this.supabase.signIn(mail, pw).then((res) => {
console.log(res);
console.log(this.supabase.user)
alert('Logged in!');
}).catch((err) => {
console.log(err)
this.loading = false;
});
}
Console output:
Object { data: null, user: null, session: null, error: {…} }
null
Kelaos
07/21/2022, 5:05 PMconsole.log
defaults to INFO so how would you get a LOG
severity for instance?
EDIT: Tried using Deno's stdlib log (new to Deno) but that still shows as INFO despite doing log.error()
xavier
07/21/2022, 6:46 PMupsert
function.
On signin/signup on my app I want to store a few personal data of my user, i do it with
const { data: user, error } = await supabase.from('user_data').upsert({
first_name: data.firstName.localized.en_US,
last_name: data.localizedLastName,
profile_pic: avatarURL,
access_token: token
});
I used an upsert
to insert a new row if the user doesn't exist, update a row otherwise. But it doesn't works, the current code add a new row on each new signin.
What am I missing?garyaustin
07/21/2022, 6:48 PMxavier
07/21/2022, 6:49 PM