Skip to content

Comments

DEV-4 - setup supabase and user authentication#7

Merged
safipatel merged 21 commits intomainfrom
DEV-4-user-authentication
Feb 26, 2025
Merged

DEV-4 - setup supabase and user authentication#7
safipatel merged 21 commits intomainfrom
DEV-4-user-authentication

Conversation

@chenxin-yan
Copy link
Member

@chenxin-yan chenxin-yan commented Feb 24, 2025

Jira issue

📌 What’s Changed

✅ Actions Needed

  • ✅ It might be a limitation of using OAuth with supabase. We cannot get user email before they registered. As a result, when recognizing a non nyu user, the account information would still be stored in database.
    • We would need to delete the account in database every time a non nyu user logged in. I wonder if there is a more elegant way of doing this.
  • ✅ I am not sure how environmental variables should be handled when using devcontainer. I listed all the expected variables in .env.example and they should be set in .env.local. @safipatel you might need to take a look at it.

🔗 Links

@chenxin-yan chenxin-yan marked this pull request as draft February 24, 2025 20:46
@chenxin-yan chenxin-yan marked this pull request as ready for review February 25, 2025 02:51
@safipatel safipatel changed the title setup supabase and user authentication DEV-4 - setup supabase and user authentication Feb 25, 2025
@safipatel
Copy link
Contributor

Re: environment variables -> the example env file is good and good catch to consider .devcontainers but it seems like its fine . Next.js is the one reading them in, so as long as people make the file in the repository it should read them in even if its a container.

I do have to put these environment variables into Kubernetes, so that might take a second to figure out before I merge this in.

@safipatel
Copy link
Contributor

@chenxin-yan
Copy link
Member Author

@safipatel I will take a look. It seems we can achieve this through a Supabase function and trigger. However, I am wondering if we can pass arguments to the function instead of hardcoding the allowed domains in the Supabase function.

@chenxin-yan
Copy link
Member Author

@safipatel I configured supabase function and trigger, it should be working now. I deleted code that handles domain check as it is handled on database side now. I stored allowed domains in database rather than as env variables so database functions can have access to that infromation.

@safipatel safipatel merged commit 13beb8c into main Feb 26, 2025
1 check passed
@safipatel safipatel deleted the DEV-4-user-authentication branch February 26, 2025 20:25
@safipatel
Copy link
Contributor

Another FYI:
On deployment, we kept getting redirected back to localhost:3000 because of this
https://github.com/orgs/supabase/discussions/26483#discussioncomment-9495394
image
So we have to add the redirect to the allowed list, also see this: https://supabase.com/docs/guides/auth/redirect-urls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants