Gathering detailed insights and metrics for next-auth
Gathering detailed insights and metrics for next-auth
Gathering detailed insights and metrics for next-auth
Gathering detailed insights and metrics for next-auth
npm install next-auth
Typescript
Module System
Node Version
NPM Version
62.9
Supply Chain
83.8
Quality
93.4
Maintenance
50
Vulnerability
92.1
License
@auth/azure-tables-adapter@1.7.4
Published on 16 Nov 2024
@auth/d1-adapter@1.7.4
Published on 16 Nov 2024
@auth/dgraph-adapter@2.7.4
Published on 16 Nov 2024
@auth/drizzle-adapter@1.7.4
Published on 16 Nov 2024
@auth/dynamodb-adapter@2.7.4
Published on 16 Nov 2024
@auth/edgedb-adapter@1.7.4
Published on 16 Nov 2024
TypeScript (93.33%)
JavaScript (2.74%)
CSS (1.35%)
Shell (0.96%)
Svelte (0.96%)
PLpgSQL (0.26%)
Pug (0.25%)
Dockerfile (0.12%)
HTML (0.04%)
Total Downloads
87,497,291
Last Day
104,891
Last Week
937,239
Last Month
4,766,735
Last Year
48,027,867
25,365 Stars
3,801 Commits
3,588 Forks
110 Watching
69 Branches
853 Contributors
Minified
Minified + Gzipped
Latest Version
4.24.11
Package Id
next-auth@4.24.11
Unpacked Size
808.25 kB
Size
180.37 kB
File Count
486
NPM Version
10.1.0
Node Version
20.8.0
Publised On
06 Dec 2024
Cumulative downloads
Total Downloads
Last day
-51%
104,891
Compared to previous day
Last week
-19%
937,239
Compared to previous week
Last month
2.9%
4,766,735
Compared to previous month
Last year
83.9%
48,027,867
Compared to previous year
5
39
Authentication for Next.js
Open Source. Full Stack. Own Your Data.
NextAuth.js is a complete open source authentication solution for Next.js applications.
It is designed from the ground up to support Next.js and Serverless.
This is a monorepo containing the following packages / projects:
next-auth
package@next-auth/*-adapter
packagesnpm install next-auth
The easiest way to continue getting started, is to follow the getting started section in our docs.
We also have a section of tutorials for those looking for more specific examples.
See next-auth.js.org for more information and documentation.
NextAuth.js can be used with or without a database.
Advanced options allow you to define your own routines to handle controlling what accounts are allowed to sign in, for encoding and decoding JSON Web Tokens and to set custom cookie security policies and session properties, so you can control who is able to sign in and how often sessions have to be re-validated.
NextAuth.js comes with built-in types. For more information and usage, check out the TypeScript section in the documentation.
1// pages/api/auth/[...nextauth].js 2import NextAuth from "next-auth" 3import AppleProvider from "next-auth/providers/apple" 4import GoogleProvider from "next-auth/providers/google" 5import EmailProvider from "next-auth/providers/email" 6 7export default NextAuth({ 8 secret: process.env.SECRET, 9 providers: [ 10 // OAuth authentication providers 11 AppleProvider({ 12 clientId: process.env.APPLE_ID, 13 clientSecret: process.env.APPLE_SECRET, 14 }), 15 GoogleProvider({ 16 clientId: process.env.GOOGLE_ID, 17 clientSecret: process.env.GOOGLE_SECRET, 18 }), 19 // Sign in with passwordless email link 20 EmailProvider({ 21 server: process.env.MAIL_SERVER, 22 from: "<no-reply@example.com>", 23 }), 24 ], 25})
The useSession()
React Hook in the NextAuth.js client is the easiest way to check if someone is signed in.
1import { useSession, signIn, signOut } from "next-auth/react" 2 3export default function Component() { 4 const { data: session } = useSession() 5 if (session) { 6 return ( 7 <> 8 Signed in as {session.user.email} <br /> 9 <button onClick={() => signOut()}>Sign out</button> 10 </> 11 ) 12 } 13 return ( 14 <> 15 Not signed in <br /> 16 <button onClick={() => signIn()}>Sign in</button> 17 </> 18 ) 19}
Use the <SessionProvider>
to allow instances of useSession()
to share the session object across components. It also takes care of keeping the session updated and synced between tabs/windows.
1import { SessionProvider } from "next-auth/react" 2 3export default function App({ 4 Component, 5 pageProps: { session, ...pageProps }, 6}) { 7 return ( 8 <SessionProvider session={session}> 9 <Component {...pageProps} /> 10 </SessionProvider> 11 ) 12}
If you think you have found a vulnerability (or not sure) in NextAuth.js or any of the related packages (i.e. Adapters), we ask you to have a read of our Security Policy to reach out responsibly. Please do not open Pull Requests/Issues/Discussions before consulting with us.
NextAuth.js is made possible thanks to all of its contributors.
We're happy to announce we've recently created an OpenCollective for individuals and companies looking to contribute financially to the project!
Clerk
💵
|
Auth0
💵
|
FusionAuth
💵
|
Stytch
💵
|
Prisma
💵
|
Neon
💵
|
Beyond Identity
💵
|
Lowdefy
💵
|
Descope
💵
|
Badass Courses
💵
|
Encore
💵
|
Sent.dm
💵
|
Arcjet
💵
|
Route4Me
💵
|
Netlight
☁️
|
Checkly
☁️
|
superblog
☁️
|
Vercel
☁️
|
We're open to all community contributions! If you'd like to contribute in any way, please first read our Contributing Guide.
ISC
Stable Version
2
9.1/10
Summary
NextAuth.js before 4.10.3 and 3.29.10 sending verification requests (magic link) to unwanted emails
Affected Versions
< 3.29.10
Patched Versions
3.29.10
9.1/10
Summary
NextAuth.js before 4.10.3 and 3.29.10 sending verification requests (magic link) to unwanted emails
Affected Versions
>= 4.0.0, < 4.10.3
Patched Versions
4.10.3
5
8.1/10
Summary
Missing proper state, nonce and PKCE checks for OAuth authentication
Affected Versions
< 4.20.1
Patched Versions
4.20.1
7.1/10
Summary
Improper handling of email input
Affected Versions
>= 4.0.0, < 4.9.0
Patched Versions
4.9.0
7.1/10
Summary
Improper handling of email input
Affected Versions
< 3.29.8
Patched Versions
3.29.8
7.5/10
Summary
Improper Handling of `callbackUrl` parameter in next-auth
Affected Versions
>= 4.0.0, < 4.5.0
Patched Versions
4.5.0
7.5/10
Summary
Improper Handling of `callbackUrl` parameter in next-auth
Affected Versions
< 3.29.5
Patched Versions
3.29.5
5
5.3/10
Summary
Possible user mocking that bypasses basic authentication
Affected Versions
< 4.24.5
Patched Versions
4.24.5
6.1/10
Summary
URL Redirection to Untrusted Site ('Open Redirect') in next-auth
Affected Versions
>= 4.0.0, < 4.3.3
Patched Versions
4.3.3
6.1/10
Summary
URL Redirection to Untrusted Site ('Open Redirect') in next-auth
Affected Versions
< 3.29.3
Patched Versions
3.29.3
6.1/10
Summary
NextAuth.js default redirect callback vulnerable to open redirects
Affected Versions
>= 4.0.0, < 4.3.2
Patched Versions
4.3.2
6.1/10
Summary
NextAuth.js default redirect callback vulnerable to open redirects
Affected Versions
< 3.29.2
Patched Versions
3.29.2
3
3.3/10
Summary
next-auth before v4.10.2 and v3.29.9 leaks excessive information into log
Affected Versions
>= 4.0.0, < 4.10.2
Patched Versions
4.10.2
3.3/10
Summary
next-auth before v4.10.2 and v3.29.9 leaks excessive information into log
Affected Versions
< 3.29.9
Patched Versions
3.29.9
0/10
Summary
Token verification bug in next-auth
Affected Versions
< 3.3.0
Patched Versions
3.3.0
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
Found 15/26 approved changesets -- score normalized to 5
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
53 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More