mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 23:29:08 +03:00
29 lines
849 B
Markdown
29 lines
849 B
Markdown
# Flutter Supabase MFA Example
|
|
|
|
A simple app demonstrating how to implement Multi-Factor Authentication (MFA) with Supabase and Flutter.
|
|
|
|
```sql
|
|
-- Dummy table that contains "secure" information
|
|
create table if not exists public.private_posts (
|
|
id int generated by default as identity primary key,
|
|
content text not null
|
|
);
|
|
|
|
-- Dmmy "secure" data
|
|
insert into public.private_posts
|
|
(content)
|
|
values
|
|
('Flutter is awesome!'),
|
|
('Supabase is awesome!'),
|
|
('Postgres is awesome!');
|
|
|
|
-- Enable RLS for private_posts table
|
|
alter table public.private_posts enable row level security;
|
|
|
|
-- Create a policy that only allows read if they user has signed in via MFA
|
|
create policy "Users can view private_posts if they have signed in via MFA"
|
|
on public.private_posts
|
|
for select
|
|
to authenticated
|
|
using (auth.jwt()->>'aal' = 'aal2');
|
|
``` |