Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add next.js auth helpers for server components #380

Merged
merged 7 commits into from Nov 15, 2022

Conversation

dijonmusters
Copy link
Contributor

@dijonmusters dijonmusters commented Nov 14, 2022

What kind of change does this PR introduce?

Add an additional auth helper function for createServerComponentSupabaseClient. This, paired with a middleware function to refresh the Supabase session, make it possible to use an authenticated Supabase client in a Next.js 13 Server Component - the app directory.

The app directory is still in beta so is likely to change. This should be seen as an experimental approach to start trying out Server Components with Supabase.

What is the current behavior?

There is no supported way to create an authenticated Supabase client in a server component

#341

What is the new behavior?

We have an experimental way to create an authenticated Supabase client in a server component

Copy link
Member

@thorwebdev thorwebdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

'@supabase/auth-helpers-nextjs': patch
---

Add helper for Next.js Server Components
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Add helper for Next.js Server Components
feat: add helper for Next.js Server Components.

@dijonmusters dijonmusters merged commit 2be3f10 into main Nov 15, 2022
@dijonmusters dijonmusters deleted the feat/add-next-js-13-example branch November 15, 2022 04:43
@thorwebdev thorwebdev linked an issue Nov 15, 2022 that may be closed by this pull request
@Metaphysics0
Copy link

Awesome work @dijonmusters

I like the <SupabaseListener /> that you included in the top level layout.

I wanted to ask, how can I access this session from the child components without having to await it?
Do I need to wrap this in a provider of some sort?

Thanks so much.

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.

Next.js 13 app directory support
3 participants