Closed jjfantini closed 2 weeks ago
Here are some resources to use when you are implementing user authentication flow anonymously. Supabase Supports Anonymous Sign-In Anonymous Sign-In Documentation Linking Identity with E-Mail/OAuth Docs
Closed with #41 and #47
Forget everything that we had worked on in the last development iteration. I have decided on a new user authenticaiton flow, one that is much easeier, and won't rely on a database. This will speed up the authentication process, so users aren't waiting for a DB call to check if they are in the DB.
Main Goal:
Users are now going to be anonymously authenticated. This flow creates 3 different types of users:
is_anonymous = undef ; postgres_role = anonymous
is_anonymous = TRUE ; postgres_role = authenticated
is_anonymous = FALSE ; postgres_role = authenticated
The authenicated users (both anonymous & permanent) will have access to the
(private)/dashboard
route. Authenticated anonymous users will have restricted features on the dashboard, like not being able to save a custom list of tickers in their portfolio. The goal of having authenticated anonymous users is to let them see the internals of the dahboard and get the most basic features without any customization. Authenicated permanent users will be able to interact with the dashboard as a BASIC user (not subscribed to plan)...details to follow.Authentication Flow:
/landing-page
root.Dashboard
button in the top header. #25Dashboard
button triggers thesupabase.auth.signInAnonymously()
function.Dashboard
button functionality andLoginModal
). The user can also sign-up with aSign Up
button in the header (only present when the user is anonymous)supabase.auth.updateUser
orsupabase.auth.linkIdentity
to use an OAuth Provider and link the user to their account and email.There should still be login support for passwordless methods (magic-link/OTP). THe emails entered to retireve these codes will be linked to a permanent user.
**There are compnents from the
login/page.tsx
that have been created that can be re-used.OAuth Providers:
Notes
When you use a social provider to login, you should also extract the meta data (username, full_name, avatar_url, email) to populate the Profile of the user on humblFINANCE. To greet the user using their full name and populate the fields that the user can edit.
References
Here are some resources to use when you are implementing user authentication flow anonymously. Supabase Supports Anonymous Sign-In Anonymous Sign-In Documentation Linking Identity with E-Mail/OAuth Docs