0.8.3 • Published 7 months ago

authey v0.8.3

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Authey

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

Installation

npm install @auth/core authey

Usage

Express

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

// server/middleware/auth.ts
import { createAuthMiddleware } from 'authey'
import { fromNodeMiddleware } from 'h3'

export default fromNodeMiddleware(createAuthMiddleware(authConfig))

Fastify

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

0.8.1

10 months ago

0.8.3

7 months ago

0.8.2

9 months ago

0.7.0

11 months ago

0.6.1

11 months ago

0.6.0

11 months ago

0.5.0

1 year ago

0.4.0

1 year ago

0.4.2

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.0

1 year ago