# authey

> Expose Auth.js REST APIs to any connect-compatible Node.js framework.

Latest version **0.8.3** (published 2023-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install authey
pnpm add authey
yarn add authey
bun add authey
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.3 |
| Published | 2023-10-20 |
| First published | 2022-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 17.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 45 |
| Author | Robert Soriano |
| Maintainers | wobsoriano |
| Keywords | auth, next-auth, authjs, authentication |

## Links

- npm: https://www.npmjs.com/package/authey
- Repository: https://github.com/wobsoriano/authey
- Homepage: https://github.com/wobsoriano/authey#readme
- Issues: https://github.com/wobsoriano/authey/issues
- npm.io page: https://npm.io/package/authey

## Dependencies (4)

- [requrl](https://npm.io/package/requrl.md) ^3.0.2
- [@polka/send-type](https://npm.io/package/@polka/send-type.md) ^0.5.2
- [node-fetch-native](https://npm.io/package/node-fetch-native.md) ^1.4.0
- [set-cookie-parser](https://npm.io/package/set-cookie-parser.md) ^2.6.0

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 0.8.3 (latest) — 2023-10-20
- 0.8.2 — 2023-08-09
- 0.8.1 — 2023-07-28
- 0.7.0 — 2023-06-28
- 0.6.1 — 2023-06-21
- 0.6.0 — 2023-06-05
- 0.5.0 — 2023-05-03
- 0.4.2 — 2023-03-29
- 0.4.0 — 2023-03-29
- 0.3.0 — 2023-01-30
- 0.2.0 — 2022-12-29
- 0.1.7 — 2022-12-22
- 0.1.6 — 2022-12-17
- 0.1.5 — 2022-12-16
- 0.1.4 — 2022-12-16
- … 3 more at https://npm.io/package/authey/versions

## 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: '<no-reply@example.com>',
    }),
  ],
}

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

---
_Source: https://npm.io/package/authey · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
