Azure Table Storage Adapter
리소스
설정
설치
npm install @auth/azure-tables-adapter
환경 변수
AUTH_AZURE_ACCOUNT=storageaccountname
AUTH_AZURE_ACCESS_KEY=longRandomKey
AUTH_AZURE_TABLES_ENDPOINT=https://$AZURE_ACCOUNT.table.core.windows.net
설정
- 아래 예제에서
auth
라는 인증 데이터 테이블을 생성합니다.
./auth.ts
import NextAuth, { type AuthConfig } from "next-auth"
import { TableStorageAdapter } from "@auth/azure-tables-adapter"
import { AzureNamedKeyCredential, TableClient } from "@azure/data-tables"
const credential = new AzureNamedKeyCredential(
process.env.AUTH_AZURE_ACCOUNT,
process.env.AUTH_AZURE_ACCESS_KEY
)
const authClient = new TableClient(
process.env.AUTH_AZURE_TABLES_ENDPOINT,
"auth",
credential
)
export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [],
adapter: TableStorageAdapter(authClient),
} satisfies AuthConfig)