Lesourdingo
03/23/2023, 12:43 PMKoen
03/23/2023, 12:51 PMSniped137
03/23/2023, 12:57 PMA83
03/23/2023, 1:15 PMa11hard
03/23/2023, 1:24 PM.well-known/openid-configuration
)?
In other words does this auth helper retrieve the JWKs from the url in the well known open id configuration endpoint to verify the signature of the token issued by keycloack and refresh the tokens?Rytterboi
03/23/2023, 3:24 PMDwarfNinja
03/23/2023, 3:34 PMFirebaseAuth.instance.authStateChanges()
in the StreamBuilder and if I was not logged in the connection completed without data and I was sent to the Login
page, vice vera if I was logged in the connection completed with data and I was brought to the Home
page. However I'm trying to use Supabase.instance.client.auth.onAuthStateChange
the same way but it seems that it does not work the same. How can I achieve what I had with Firebase in Supabase, or is there an alternative I'm missing?
dart
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Communion',
theme: CustomTheme.lightTheme,
home: StreamBuilder<AuthState>(
stream: Supabase.instance.client.auth.onAuthStateChange, //used to be FirebaseAuth.instance.authStateChanges()
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
}
else if (snapshot.hasData) {
return const Home();
}
else {
return const LogIn();
}
}
),
routes: {
'/login': (context) => const LogIn(),
'/signup': (context) => const SignUp(),
'/profile': (context) => const Profile(),
},
);
}
}
gbg
03/23/2023, 5:29 PMSriniketh J
03/23/2023, 5:32 PMresult = client.storage().list_bucket()
Reference: https://supabase.com/docs/reference/python/storage-createbucketharshcut
03/23/2023, 6:28 PMMaarten
03/23/2023, 6:44 PMsupabase.rpc()
. I have the following types for my database function:
typescript
Functions: {
search_by_placename: {
Args: {
search_query: string
}
Returns: {
id: string
placename: string
municipality: string
province: string
coords: string
}[]
}
}
As you can see, this returns an array with some object properties. However, when calling this method using supabase.rpc()
the array type is duplicated, resulting in [][]
(a nested array):
typescript
const data: {
id: string;
placename: string;
municipality: string;
province: string;
coords: string;
}[][] | null
Is this a bug?AlwaysBlue
03/23/2023, 6:44 PMpublic.users
. In this table if frontend calls
supabase
.from('users')
.select('*')
then It should only return user with email which is in supabase header token have but if it is called by backend it should return all the rows.
What would be the policy I should add in attached screenshot below
Consider the token to be this
const userDetails = {
name,
email,
};
const token = jwt.sign({ ...userDetails }, SUPABASE_JWT_SECRET || '');
and this is how I am creating supabase client
createClient<Database>(
VITE_SUPABASE_URL,
VITE_SUPABASE_ANON_KEY,
{
global: {
headers: {
Authorization: `Bearer ${token}`,
},
},
}
);
MusashiGarami
03/23/2023, 7:03 PMstaya
03/23/2023, 8:33 PMalitnk
03/23/2023, 9:39 PMfailed to close prepared statement: ERROR: current transaction is aborted, commands ignored until end of transaction block (SQLSTATE 25P02): ERROR: duplicate key value violates unique constraint "users_email_partial_key" (SQLSTATE 23505)
Is there any way to match the email, find the right user and then log them in?A83
03/23/2023, 10:25 PMauth-helpers-sveltekit
everything works except the header component.
<!-- src/lib/components/Header.svelte -->
<script lang="ts">
import type { Session } from '@supabase/supabase-js';
export let session: Session | null;
</script>
{#if !session}
<h1>I am not logged in</h1>
{:else}
<h1>Welcome {session.user.email}</h1>
<p>I am logged in!</p>
{/if}
In the console I get: <Header> was created without expected prop 'session'
.
Thankspandainhumanskin
03/23/2023, 10:45 PMŠdam
03/23/2023, 11:11 PMashman
03/24/2023, 12:22 AMexport const getServerSideProps = async (ctx) => {
// Create authenticated Supabase Client
const supabase = createServerSupabaseClient(ctx);
// Check if we have a session
const {
data: { session },
} = await supabase.auth.getSession();
const userId = session.user.id;
console.log("session:", session);
const { data } = await supabase
.from("user_profiles_view")
.select("*")
.eq("id", userId)
.single();
console.log("userId", userId);
console.log("profileData", data);
if (!session)
return {
redirect: {
destination: "/",
permanent: false,
},
};
return {
props: {
initialSession: session,
user: session.user,
profileData: data ?? [],
},
};
};
AmusedGrape
03/24/2023, 1:57 AMcan_access_workspace(id, auth.uid())
The function code for that is here:
sql
CREATE OR REPLACE FUNCTION public.can_access_workspace(
workspaceId uuid,
uid uuid
)
RETURNS boolean
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = public
AS $$
DECLARE
w workspaces;
BEGIN
SELECT * INTO w FROM workspaces WHERE "id" = workspaceId;
IF uid = w.owner THEN
RETURN true;
END IF;
IF EXISTS (
SELECT * FROM workspace_members
WHERE workspace_members."user" = uid
AND workspace_members.workspace = w.id
) THEN
RETURN true;
END IF;
RETURN false;
END;
$$;
If I test it with SELECT can_access_workspace('721e2689-ce82-42ef-b78a-c591f8832484', '812052d6-9948-43d0-a5ad-8bf1f1bae5b2')
it works fine (returns true), but using it in the RLS policy doesn't seem to work. I'm fetching all workspaces
and nothing is returned.
What am I doing wrong?nnet3
03/24/2023, 2:51 AMriccardolardi
03/24/2023, 7:36 AMFailed to invite user: failed to make invite request: Database error finding user
also when I switch to the Storage page I get Internal Server Error
. Does anyone has an idea what happened here? Thanks!jksoftdev
03/24/2023, 8:38 AMSTILLWATER;
03/24/2023, 9:52 AMMarkido
03/24/2023, 10:29 AMGuille
03/24/2023, 10:33 AMApe R Us
03/24/2023, 10:43 AMKennStack01
03/24/2023, 11:00 AMtom-s3drive
03/24/2023, 12:29 PMGOTRUE_SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION
, but now my users can't really use reset password workflow due to: "Password update requires reauthentication" error when they're shown password update form (after they've clicked password reset e-mail).
Is the reauthentication feature for password change
compatible with the password reset
workflow?gbg
03/24/2023, 12:33 PM