refactor: plugin export paths

This commit is contained in:
Bereket Engida
2024-11-02 22:53:02 +03:00
parent e0977076f1
commit 87f49b7eab
26 changed files with 109 additions and 38 deletions
+3 -4
View File
@@ -28,14 +28,13 @@ This plugin offers two main methods to do a second factor verification:
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { twoFactor } from "better-auth/plugins" // [!code highlight]
import { twoFactor } from "better-auth/plugins/two-factor" // [!code highlight]
export const auth = betterAuth({
// ... other config options
appName: "My App", // provide your app name. It'll be used as an issuer. // [!code highlight]
plugins: [
twoFactor({ // [!code highlight]
issuer: "my-app" // [!code highlight]
}) // [!code highlight]
twoFactor() // [!code highlight]
]
})
```
+1 -1
View File
@@ -16,7 +16,7 @@ The Admin plugin provides a set of administrative functions for user management
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { admin } from "better-auth/plugins" // [!code highlight]
import { admin } from "better-auth/plugins/admin" // [!code highlight]
export const auth = betterAuth({
// ... other config options
+1 -1
View File
@@ -15,7 +15,7 @@ The Anonymous plugin allows users to have an authenticated experience without re
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { anonymous } from "better-auth/plugins" // [!code highlight]
import { anonymous } from "better-auth/plugins/anonymous" // [!code highlight]
export const auth = betterAuth({
// ... other config options
+1 -1
View File
@@ -11,7 +11,7 @@ Add the Bearer plugin to your authentication setup:
```ts title="auth.ts"
import { betterAuth } from "better-auth";
import { bearer } from "better-auth/plugins";
import { bearer } from "better-auth/plugins/bearer";
export const auth = betterAuth({
plugins: [bearer()]
+1 -1
View File
@@ -19,7 +19,7 @@ You can't register a user using the email OTP plugin. You can only sign in or ve
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { emailOTP } from "better-auth/plugins" // [!code highlight]
import { emailOTP } from "better-auth/plugins/email-otp" // [!code highlight]
export const auth = betterAuth({
// ... other config options
+1 -1
View File
@@ -15,7 +15,7 @@ The Generic OAuth plugin provides a flexible way to integrate authentication wit
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { genericOAuth } from "better-auth/plugins" // [!code highlight]
import { genericOAuth } from "better-auth/plugins/generic-oauth" // [!code highlight]
export const auth = betterAuth({
// ... other config options
+1 -1
View File
@@ -17,7 +17,7 @@ The JWT plugin provides endpoints to retrieve a JWT token and a JWKS endpoint to
### Add the plugin to your **auth** config
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { jwt, bearer } from "better-auth/plugins"
import { jwt, bearer } from "better-auth/plugins/jwt"
export const auth = betterAuth({
plugins: [ // [!code highlight]
+1 -1
View File
@@ -14,7 +14,7 @@ Magic link or email link is a way to authenticate users without a password. When
```ts title="server.ts"
import { betterAuth } from "better-auth";
import { magicLink } from "better-auth/plugins";
import { magicLink } from "better-auth/plugins/magic-link";
export const auth = betterAuth({
plugins: [
+1 -1
View File
@@ -12,7 +12,7 @@ The multi-session plugin allows users to maintain multiple active sessions acros
### Add the plugin to your **auth** config
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { multiSession } from "better-auth/plugins"
import { multiSession } from "better-auth/plugins/multi-session"
export const auth = betterAuth({
plugins: [ // [!code highlight]
+1 -1
View File
@@ -12,7 +12,7 @@ Organizations simplifies user access and permissions management. Assign roles an
### Add the plugin to your **auth** config
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { organization } from "better-auth/plugins"
import { organization } from "better-auth/plugins/organization"
export const auth = betterAuth({
plugins: [ // [!code highlight]
+1 -1
View File
@@ -24,7 +24,7 @@ The passkey plugin implementation is powered by [simple-web-authn](https://simpl
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { passkey } from "better-auth/plugins"
import { passkey } from "better-auth/plugins/passkey"
export const auth = betterAuth({
+1 -1
View File
@@ -13,7 +13,7 @@ The phone number plugin extends the authentication system by allowing users to s
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { phoneNumber } from "better-auth/plugins"
import { phoneNumber } from "better-auth/plugins/phone-number"
const auth = betterAuth({
plugins: [
+1 -1
View File
@@ -13,7 +13,7 @@ The username plugin wraps the email and password authenticator and adds username
```ts title="auth.ts"
import { betterAuth } from "better-auth"
import { username } from "better-auth/plugins"
import { username } from "better-auth/plugins/username"
const auth = betterAuth({
plugins: [ // [!code highlight]