https://github.com/wobsoriano/authey
Universal support for Auth.js.
https://github.com/wobsoriano/authey
auth authjs nextauth
Last synced: 4 months ago
JSON representation
Universal support for Auth.js.
- Host: GitHub
- URL: https://github.com/wobsoriano/authey
- Owner: wobsoriano
- License: mit
- Created: 2022-12-16T08:15:47.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-20T17:19:28.000Z (almost 2 years ago)
- Last Synced: 2025-06-10T17:58:24.818Z (4 months ago)
- Topics: auth, authjs, nextauth
- Language: TypeScript
- Homepage:
- Size: 815 KB
- Stars: 46
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Authey
Expose [Auth.js](https://authjs.dev/) [REST APIs](https://next-auth.js.org/getting-started/rest-api) to any [connect](https://github.com/senchalabs/connect)-compatible Node.js framework.
## Installation
```bash
npm install @auth/core authey
```## Usage
Express
```ts
import express from 'express'import { createAuthMiddleware } from 'authey'
import type { AuthConfig } from '@auth/core'
import AppleProvider from '@auth/core/providers/apple'
import GoogleProvider from '@auth/core/providers/google'
import EmailProvider from '@auth/core/providers/email'const app = express()
const authConfig: AuthConfig = {
// You can generate a secret here https://generate-secret.vercel.app/32
secret: process.env.AUTH_SECRET,
trustHost: Boolean(process.env.AUTH_TRUST_HOST),
providers: [
// OAuth authentication providers
AppleProvider({
clientId: process.env.APPLE_ID,
clientSecret: process.env.APPLE_SECRET,
}),
GoogleProvider({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,
}),
// Sign in with passwordless email link
EmailProvider({
server: process.env.MAIL_SERVER,
from: '',
}),
],
}app.use(createAuthMiddleware(authConfig))
```Nuxt
```ts
// server/middleware/auth.ts
import { createAuthMiddleware } from 'authey'
import { fromNodeMiddleware } from 'h3'export default fromNodeMiddleware(createAuthMiddleware(authConfig))
```Fastify
```ts
import Fastify from 'fastify'
import Middie from '@fastify/middie'
import { createAuthMiddleware } from 'authey'async function build() {
const fastify = Fastify()
await fastify.register(Middie)
fastify.use(createAuthMiddleware(authConfig))
return fastify
}// Plugin: https://github.com/wobsoriano/fastify-next-auth
```## License
MIT