BallisticSwami
04/04/2022, 4:32 AMLeoSonnekus
04/04/2022, 5:23 AMMrPoule
04/04/2022, 6:47 AMsbr
04/04/2022, 8:53 AMsupabase.auth.token
key. Indeed supabase.io does the same. But in my NextJS app with auth-helpers I'm not seeing anything in local storage but two cookies with the name sb-access-token
and sb-refresh-token
. Can someone please explain why it's different for my app?BigDoofus
04/04/2022, 9:17 AMconst {data: resources} = await supabase.from('resources').select("*",`profiles(*)`)
cbert
04/04/2022, 9:25 AMsupabase :>> SupabaseClient {
...
headers: {
'X-Client-Info': 'supabase-js/1.32.2',
apikey: 'apikey',
Authorization: 'Bearer apikey'
},
shouldThrowOnError: false,
auth: SupabaseAuthClient {
stateChangeEmitters: Map(50) {
...
},
currentUser: null,
currentSession: {
access_token: 'valid access token',
token_type: 'bearer',
user: null
},
autoRefreshToken: true,
persistSession: true,
multiTab: true,
localStorage: undefined,
api: GoTrueApi {
url: 'my endpoint',
headers: [Object],
cookieOptions: [Object],
fetch: [Function (anonymous)]
}
},
realtime: RealtimeClient {
accessToken: null,
channels: [],
endPoint: 'my wss endpoint',
headers: { 'X-Client-Info': 'supabase-js/1.32.2' },
params: {
apikey: 'correct api key'
},
timeout: 10000,
...
}
}
As you can see the tokens and keys are correct, but I don't get user info back. Is this expected or the reason I'm getting 406 error?chrisb2244
04/04/2022, 9:52 AMBigDoofus
04/04/2022, 10:07 AMsilentworks
04/04/2022, 11:12 AMsilentworks
04/04/2022, 11:46 AMmalaleche
04/04/2022, 12:38 PMwarren
04/04/2022, 1:51 PMAruzo
04/04/2022, 2:41 PMlrnecgcysiam
04/04/2022, 4:52 PMtheuknowner
04/04/2022, 4:53 PMAdi
04/04/2022, 5:54 PMzavbala
04/04/2022, 6:24 PMsbr
04/04/2022, 7:09 PMwithoutAuthRequired
?
My logic is-
- /login
should be shown only if a user is not authenticated
- If a user is authenticated then /login
should redirect to /home
- /home
should be shown only if a user is authenticated
- If a user is not authenticated then /home
should redirect to /login
The last two points can use withAuthRequired
. How can the first two points be implemented?StickSeas
04/04/2022, 7:20 PMmalaleche
04/04/2022, 7:37 PMasync function handleFile(){
const formData = new FormData();
formData.append("file", file);
let resp = await fetch( '/api/file', {
method: 'POST',
body: formData,
})
console.log(resp)
}
//api/file.js
import {supabase} from '/src/lib/supabaseClient'
export async function post(event) {
const data = await event.request.formData();
const fichero = data.get('file')
const {data: imageData, error:imageError} = await supabase
.storage
.from('images')
.upload("algomio/"+Date.now(),fichero,{
cacheControl: '3600',
upsert: false
})
if(imageData){
console.log("imageData: ",imageData)
}
if(imageError){
console.log("imageError:", imageError)
}
return {
body: {algo:"algo"}
}
}
โjoshiโ
04/04/2022, 8:25 PMStickSeas
04/04/2022, 8:31 PMconst { data: user, error } = await supabase.auth.api.createUser({
email: username,
password: password,
data: {
first_name: first,
last_name: last,
address: address
}
});
This always ends up having the user_metadata as a blank object.
console.log(user);
{
id: 'deg84a9f-334e-8v6s-81bd-87dd864e0t187',
aud: 'authenticated',
role: 'authenticated',
email: 'email@email.com',
phone: '',
app_metadata: { provider: 'email', providers: [ 'email' ] },
user_metadata: {},
identities: null,
created_at: '2022-04-04T19:14:21.704112Z',
updated_at: '2022-04-04T19:14:21.705655Z'
}
Martin INDIE MAKERS
04/04/2022, 8:42 PMAmos
04/04/2022, 8:47 PMjbalvin
04/04/2022, 9:30 PMBigSamHam
04/05/2022, 12:37 AMDuckstroyer
04/05/2022, 4:52 AMForeign keys between database schemas are not supported in Prisma.
to use both supabase and prisma in a project? Or is it just not really possible? I'm okay with organizing my database differently if I can use both tools, but I'm curious if I have to be chooseyMichie
04/05/2022, 4:59 AMkjellski
04/05/2022, 7:07 AMwiesson
04/05/2022, 9:23 AM