Security
Intermediate
Authentication
Implement authentication with Auth.js, Proxy request gates, and server-side authorization checks.
30 min
3 sections
auth
nextauth
security
1
2
3
01. Setting Up Auth.js
Section 1 of 3
Configure Auth.js through the next-auth package with OAuth providers and server-side session helpers.
typescript
// auth.ts
import NextAuth from 'next-auth';
import Google from 'next-auth/providers/google';
export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [
Google({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
],
});Exercise
Set Up Basic Auth
Practice
Install next-auth and configure Auth.js with a basic credential provider.
Back to Course