The Easiest Way to add Auth to a Next App

  Рет қаралды 3,076

Sam Meech-Ward

Sam Meech-Ward

Күн бұрын

Learn how to add auth to your next application using next auth and github login.
Newer next auth video for next 14: • Effortless Auth in Nex...
Code:
www.sammeechward.com/the-easi...
Next & Prisma: • Prisma & Next.js
Next Auth & Prisma: • Next Auth and Prisma
Join this channel to get access to perks:
/ @sammeechward
Chapters:
0:00​ Intro
1:31 Setup Next Auth
3:58 Setup Github Login
6:05 Session Provider
7:29 useSession
11:00 unstable_getServerSession
14:08 Restrict Pages
15:50 Nav Bar
17:17 Next Image
19:12 Restrict API
21:03 Summary
🔗Moar Links
My Website: www.sammeechward.com
Instagram: / meech_ward
Twitter: / meech_ward
Github: github.com/orgs/Sam-Meech-Ward

Пікірлер: 17
@sohrabradmehrgaming1556
@sohrabradmehrgaming1556 Жыл бұрын
Best next auth video!
@dnial6992
@dnial6992 Жыл бұрын
I love this kind of contents! Keep it up idol! Wish you can make content in Angular.js also. Thanks for this lesson, appreciate it.
@mdraselkhan3125
@mdraselkhan3125 Жыл бұрын
Thank you. Like this video.
@SamMeechWard
@SamMeechWard Жыл бұрын
Thank you, me too
@jamesrobert5332
@jamesrobert5332 Жыл бұрын
Thanks once again for another great video man, You're a great help! Also an update: It's no longer experimental now. unstable_getServerSession is deprecated, getServerSession works perfectly now
@Chris...S
@Chris...S Жыл бұрын
Was hoping you included Microsoft Azure AD B2C. Hard to find a walk through on it.
@aprilm2941
@aprilm2941 Жыл бұрын
As a premium subscriber I approve of this video
@SamMeechWard
@SamMeechWard Жыл бұрын
😅
@shattereddnb3268
@shattereddnb3268 Жыл бұрын
Great video! But I´m getting: "Server Error TypeError: Cannot read properties of undefined (reading 'getHeader')" from the getServserSideProps-function. I refactored with the new getServerSession like this: import { getServerSession } from "next-auth"; ... export const getServerSideProps = async (req, res) => { const session = await getServerSession(req, res, authOptions) ... but other than that my code is pretty much identical to yours. Any help would be greatly appreciated!
@jamesrobert5332
@jamesrobert5332 Жыл бұрын
I believe the import should come from next-auth/next, so it should be: import { getServerSession } from "next-auth/next";
@shattereddnb3268
@shattereddnb3268 Жыл бұрын
@@jamesrobert5332 I got it to work, I think what I did different was to give getServerSideProps context as an argument, and then context.req and context.res on getServerSession
@DanielTruongDev
@DanielTruongDev Жыл бұрын
does the API restriction prevent user from making request using HTTPS client like Postman?
@SamMeechWard
@SamMeechWard Жыл бұрын
If the route is protected using next auth, then other clients will need a valid next auth cookie to use those routes.
@dundasbrands
@dundasbrands Жыл бұрын
ha me as well "copilot do the work for me"
@aprilm2941
@aprilm2941 Жыл бұрын
👀
@SamMeechWard
@SamMeechWard Жыл бұрын
🤨
Set up Next-Auth with Next.js and Prisma with this ultimate guide!
42:45
Build SaaS with Ethan
Рет қаралды 50 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 541 М.
Why You Should Always Help Others ❤️
00:40
Alan Chikin Chow
Рет қаралды 98 МЛН
Каха инструкция по шашлыку
01:00
К-Media
Рет қаралды 7 МЛН
Next-Auth on App Router - Solid Auth, Super Fast
17:20
Jack Herrington
Рет қаралды 100 М.
I built the same app 10 times // Which JS Framework is best?
21:58
Fireship
Рет қаралды 2,4 МЛН
Next js App Router Authentication with AuthKit
6:22
WorkOS
Рет қаралды 299
React Proxy | Easiest Fix to CORS Errors
15:52
Sam Meech-Ward
Рет қаралды 77 М.
The Ultimate Guide to Next Auth - Everything You Need
1:36:26
Brett Westwood - Software Engineer
Рет қаралды 56 М.
Auth and Private Routes Next.js 13 | Mongodb & Next Auth Credentials
15:54
An Illustrated Guide to OAuth and OpenID Connect
16:36
OktaDev
Рет қаралды 554 М.
DiagramGPT - Honest Review of Eraser AI
8:22
Sam Meech-Ward
Рет қаралды 110 М.
Next.js Database & User Authentication Quickstart
27:15
Supabase
Рет қаралды 43 М.
Непробиваемый телевизор 🤯
0:23
FATA MORGANA
Рет қаралды 157 М.
Настоящий детектор , который нужен каждому!
0:16
Ender Пересказы
Рет қаралды 132 М.
С ноутбуком придется попрощаться
0:18
Up Your Brains
Рет қаралды 426 М.
AI от Apple - ОБЪЯСНЯЕМ
24:19
Droider
Рет қаралды 76 М.
keren sih #iphone #apple
0:16
Muhammad Arsyad
Рет қаралды 1,3 МЛН