Custom Supabase authentication using PostgreSQL functions
This is a set of PostgreSQL functions that perform customizable Supabase auth functions.
This is the core function that generates a necessary link for the following purposes:
- invite (used in a user invite email)
- magiclink (used for password-less sign in emails)
- recovery (used for password recovery emails)
- signup (used for confirming email address for email signups)
Send a JSON object to the function private.generate_auth_link
function as follows:
select private.generate_auth_link(
'{
"type": "invite",
"email": "[email protected]",
"data": { "foo": "bar2" },
"redirect_to": "http://localhost:3000"
}'
);
- according to the docs at https://github.com/supabase/gotrue#post-admingenerate_link the
data
parameter should not work here, but in my tests, it does - the
redirect_to
parameter can be customized for your application, including a complete path
Send a JSON object to the function private.generate_auth_link
function as follows:
select private.generate_auth_link(
'{
"type": "magiclink",
"email": "[email protected]",
"redirect_to": "http://localhost:3000"
}'
);
- according to the docs at https://github.com/supabase/gotrue#post-admingenerate_link the
data
parameter should not work here, but in my tests, it does - the
redirect_to
parameter can be customized for your application, including a complete path
Send a JSON object to the function private.generate_auth_link
function as follows:
select private.generate_auth_link(
'{
"type": "recovery",
"email": "[email protected]",
"redirect_to": "http://localhost:3000"
}'
);
- the
redirect_to
parameter can be customized for your application, including a complete path
Send a JSON object to the function private.generate_auth_link
function as follows:
select private.generate_auth_link(
'{
"type": "signup",
"email": "[email protected]",
"password": "password123",
"data": { "foo": "bar2" },
"redirect_to": "http://localhost:3000"
}'
);
- the
redirect_to
parameter can be customized for your application, including a complete path