Next.js Authentication with Next Auth - Protected Routes & more

preview_player
Показать описание
Initial Code:

Final Code:

Next.13 Complete Overview in Depth:

⚙️ Gadgets I use for Recording:

💻 Laptop - Macbook PRO M1 - 16/512

🎤 MIC - Samson Technologies Q2U USB/XLR Dynamic Microphone

🖱️Mouse - Logitech G402 Gaming Mouse Hyperion Fury USB, Black

⌨️ Keyboard - Logitech K380 Multi-Device Bluetooth Keyboard

🖥️ Monitor - UltraSharp 24-Inch Screen Led-Lit Monitor (U2419H)

We will use Credentials to authenticate the user, maintain the session of the authenticated user, and also we will clear the user session on logout.

We will learn how we can protect the protected routes from unauthenticated users. Make sure to watch the complete video.

Do ask your question in the comments, and I do give replies to all comments.

LIKE, SUBSCRIBE, SHARE

#nextjs #nextjs13 #nextjsauthentication
Рекомендации по теме
Комментарии
Автор

axios post for new address throwing error as "login first to access this route" while I have already logged in.

Manjunath-cn
Автор

error while trying to send data in to register api endpoint

error - unhandledRejection: MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
at _handleConnectionErrors
at NativeConnection.openUri {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) { 'localhost:27017' => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: null,
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined
}

anirudhachakrabarty
Автор

What if I want to secure the / page, the root page?

sebastiannietor
Автор

Can you make this guide with route handlers? Without the pages folder?

RvideosR
Автор

do we need to create a table in mongodb first ? is it naming next13-auth? if no, in which stage of you video have done that ?

apexyu
Автор

This is amazing! Everything I need to know is here, thank you and keep it up!

ronjones
Автор

Thanks for the detailed video. Would it be easy to add a password reset? No Next Auth tutorials ever seem to include this feature which is essential for credential-based login.

davidgwyer
Автор

How to redirect back to protected route after login?

maedesolgi
Автор

- This is Middlewheo for my multilingual, how I have to write to be able to use both Protected Route and Border translation, in a file, there is only one method of export default.
Export Default CreatineintlmiddleWare ({
Locales: ['vi', 'en'],
defaultlocale: 'vi'
})

- Moreover, I want to protect all the paths with the path began with /Dashboard
Think is/dashboard/profile or/dashboard/seting/message
Also Protected Route

ICOReviewtoken
Автор

Hey Bro, thanks for the tutorial. BTW

i think it's problem to have callbackUrl as a query params. (35:46)

how can i remove that callback url from query )


i've tried to use redirect callback and return empty string but i have callbackUrl= , i don't want to see that callbackUrl at all

mherkarapetyan
Автор

Thanks for creating nextjs videos-- i have a question if user is already login and if user tries to goto login page again, then i want user should redirect to some other page

theshortclipper
Автор

Great tutorial on Next-Auth also found out something new about api in next, Thanks.

ompatel
Автор

Thank You so much @Coding With Abbas its really simple and understandable
for me.💕💕

usamaahmad
Автор

Thanks for the video, Abbas! How to solve the glitch `Login/ Hi, Chulam` when the page is reloaded?

postoronnii__
Автор

thank you for show the different steps by steps

apexyu
Автор

why doesnt the user get routed automatically to the callbackurl after successful login?

mattmcelligott
Автор

Thank you so much for sharing your knowledge, Sir.

uminhtetoo
Автор

Thanks for the useful video. May I know why are we not using the built-in fetch function to post the form ?

adornnet
Автор

Wonderful work, currently I'm i 2:04 time, how can we make that if the user is authenticated redirected directly to the page they were denied before authentication using the redirect url, rather than typing the url by ourselves

raymondmichael
Автор

Nice video! how can i protect backend routes?

fixesdev