Skip to content

Latest commit

 

History

History
79 lines (62 loc) · 1.96 KB

README.md

File metadata and controls

79 lines (62 loc) · 1.96 KB

next-auth-steam

Steam authentication provider for NextAuth.js.

Install

npm install next-auth-steam

Quickstart

  1. Create a .env file. For configuration details, see: NextAuth Configuration Options.
# .env
NEXTAUTH_URL=
NEXTAUTH_SECRET=

Using App Router

// 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 }

Using Pages Router

// 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!
      })
    ]
  })
}

Examples

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!