Steam authentication provider for NextAuth.js.
npm install next-auth-steam
- Create a
.env
file. For configuration details, see: NextAuth Configuration Options.
# .env
NEXTAUTH_URL=
NEXTAUTH_SECRET=
// app/auth/[...nextauth]/route.ts
import NextAuth from 'next-auth'
import Steam from 'next-auth-steam'
import type { NextRequest } from 'next/server'
// Learn more: https://next-auth.js.org/configuration/initialization#route-handlers-app
async function auth(
req: NextRequest,
ctx: {
params: {
nextauth: string[]
}
}
) {
return NextAuth(req, ctx, {
providers: [
Steam(req, {
clientSecret: process.env.STEAM_SECRET!
})
]
})
}
export { auth as GET, auth as POST }
// pages/api/auth/[...nextauth].ts
import NextAuth from 'next-auth'
import Steam from 'next-auth-steam'
import type { NextApiRequest, NextApiResponse } from 'next'
// Learn more: https://next-auth.js.org/configuration/initialization#advanced-initialization
export default async function auth(req: NextApiRequest, res: NextApiResponse) {
return await NextAuth(req, res, {
providers: [
Steam(req, {
clientSecret: process.env.STEAM_SECRET!
})
]
})
}
Note
Pages Router example uses Next.js 13. App Router example uses the latest version (Next.js 15).
All examples are located in the examples
folder. Feel free to open a PR if you'd like to add another example!