generated from chadbaldwin/simple-blog-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
layout: post | ||
title: "Cleint vs Server side Auth" | ||
author: "Aug" | ||
header-style: text | ||
catalog: true | ||
tags: | ||
- Supabase DB | ||
- Authentication | ||
- Google oauth2 social login | ||
- Magic link auth | ||
--- | ||
|
||
Current Stack: nextjs 14 (app router) + next-intl + tailwind css + supabase with auth-ui | ||
|
||
While implementing social login for [8-Bit Oracle](https://8bitoracle.ai) I learned about the differences between client and server side auth. | ||
|
||
For google social login, the login flow is controlled client side, so '@supabase/ssr' createBrowserClient is used to retrieve session info after authentication. | ||
|
||
For email that sends a magic link, the link goes to an api confirm route which is in the backend, so you need to use '@supabase/ssr' createServerClient to retrieve session information after the authentication. | ||
|
||
The confusing thing is supabase auth-ui can show both logins combined on the same login widget, and the code samples from auth-ui use createClient from '@supabase/supabase-js'. | ||
|
||
Some good links for further knowledge/research: | ||
|
||
[reddit post with some clarification](https://www.reddit.com/r/Supabase/comments/17hbwqb/question_about_supabasessr_and) | ||
|
||
[good article for initial setup](https://ekremsonmezer.substack.com/p/supabase-and-nextjs-14-authentication) | ||
|
||
[github sample project](https://github.com/SamuelSackey/nextjs-supabase-example) | ||
|
||
|
||
|