diff --git a/README.md b/README.md index 122a69132c..2a5aa7c66e 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Authentication in the TypeScript ecosystem is a half-solved problem. Other open- ### Goals **** -- **Be Comprehensive**: Save users from reinventing the wheel for anything related auth. +- **Be Comprehensive**: save users from reinventing the wheel as much as possible. - **Prioritize Best Practices**: provide best practices rather than overwhelming configuration options. - **Framework Agnostic**: Support most frameworks and avoid framework specific features and solutions if possible. - **Consistency**: Provide a consistent and predictable API across all platforms diff --git a/dev/bc-fe/hono/auth.d.ts b/dev/bc-fe/hono/auth.d.ts index 7e5756cad9..0c231982cf 100644 --- a/dev/bc-fe/hono/auth.d.ts +++ b/dev/bc-fe/hono/auth.d.ts @@ -5,7 +5,7 @@ export type Auth = { provider: "sqlite"; url: "./db.sqlite"; }; - socialProvider: [ + socialProviders: [ { id: "github"; }, diff --git a/dev/bc-fe/hono/src/auth.ts b/dev/bc-fe/hono/src/auth.ts index 10b55df7d8..e5026e4ce1 100644 --- a/dev/bc-fe/hono/src/auth.ts +++ b/dev/bc-fe/hono/src/auth.ts @@ -9,7 +9,7 @@ export const auth = betterAuth({ provider: "sqlite", url: "./db.sqlite", }, - socialProvider: [ + socialProviders: [ github({ clientId: process.env.GITHUB_CLIENT_ID as string, clientSecret: process.env.GITHUB_CLIENT_SECRET as string, diff --git a/dev/solidjs/src/lib/auth.ts b/dev/solidjs/src/lib/auth.ts index 697b04b7ca..c370a919b4 100644 --- a/dev/solidjs/src/lib/auth.ts +++ b/dev/solidjs/src/lib/auth.ts @@ -5,7 +5,7 @@ export const auth = betterAuth({ provider: "sqlite", url: "./db.sqlite", }, - socialProvider: { + socialProviders: { clientId: process.env.GITHUB_CLIENT_ID as string, clientSecret: process.env.GITHUB_CLIENT_SECRET as string, }, diff --git a/docs/content/docs/authentication/apple.mdx b/docs/content/docs/authentication/apple.mdx index f6afe3c859..df9ee7c70b 100644 --- a/docs/content/docs/authentication/apple.mdx +++ b/docs/content/docs/authentication/apple.mdx @@ -15,7 +15,7 @@ description: Apple ### Configure the provider - To configure the provider, you need to import the provider and pass it to the `socialProvider` option of the auth instance. + To configure the provider, you need to import the provider and pass it to the `socialProviders` option of the auth instance. ```ts title="auth.ts" twoslash const process = { @@ -33,18 +33,12 @@ description: Apple provider: "sqlite", url: "./db.sqlite", }, - socialProvider: [ // [!code highlight] + socialProviders: { // [!code highlight] apple({ // [!code highlight] clientId: process.env.APPLE_CLIENT_ID as string, // [!code highlight] clientSecret: process.env.APPLE_CLIENT_SECRET as string, // [!code highlight] - /** // [!code highlight] - * this is optional. // [!code highlight] - * only needed if you passed a custom basePath from `/api/auth` to `betterAuth` // [!code highlight] - * or if you're using a custom domain. // [!code highlight] - */ // [!code highlight] - redirectURI: "https://example.com/api/auth/callback/apple", // [!code highlight] }), // [!code highlight] - ], // [!code highlight] + }, // [!code highlight] }) ``` diff --git a/docs/content/docs/authentication/discord.mdx b/docs/content/docs/authentication/discord.mdx index f239cdcf8a..33edb021b1 100644 --- a/docs/content/docs/authentication/discord.mdx +++ b/docs/content/docs/authentication/discord.mdx @@ -11,7 +11,7 @@ description: Discord Provider ### Configure the provider - To configure the provider, you need to import the provider and pass it to the `socialProvider` option of the auth instance. + To configure the provider, you need to import the provider and pass it to the `socialProviders` option of the auth instance. ```ts title="auth.ts" import { betterAuth } from "better-auth" @@ -22,7 +22,7 @@ description: Discord Provider provider: "sqlite", url: "./db.sqlite", }, - socialProvider: { // [!code highlight] + socialProviders: { // [!code highlight] discord: { // [!code highlight] clientId: process.env.DISCORD_CLIENT_ID as string, // [!code highlight] clientSecret: process.env.DISCORD_CLIENT_SECRET as string, // [!code highlight] diff --git a/docs/content/docs/authentication/facebook.mdx b/docs/content/docs/authentication/facebook.mdx index 004110cf88..c0837a00c2 100644 --- a/docs/content/docs/authentication/facebook.mdx +++ b/docs/content/docs/authentication/facebook.mdx @@ -11,7 +11,7 @@ description: Facebook Provider ### Configure the provider - To configure the provider, you need to import the provider and pass it to the `socialProvider` option of the auth instance. + To configure the provider, you need to import the provider and pass it to the `socialProviders` option of the auth instance. ```ts title="auth.ts" twoslash const process = { @@ -29,7 +29,7 @@ description: Facebook Provider provider: "sqlite", url: "./db.sqlite", }, - socialProvider: { // [!code highlight] + socialProviders: { // [!code highlight] facebook: { // [!code highlight] clientId: process.env.FACEBOOK_CLIENT_ID as string, // [!code highlight] clientSecret: process.env.FACEBOOK_CLIENT_SECRET as string, // [!code highlight] diff --git a/docs/content/docs/authentication/github.mdx b/docs/content/docs/authentication/github.mdx index 09cbcef0e0..dba643019d 100644 --- a/docs/content/docs/authentication/github.mdx +++ b/docs/content/docs/authentication/github.mdx @@ -11,7 +11,7 @@ description: Github Provider ### Configure the provider - To configure the provider, you need to import the provider and pass it to the `socialProvider` option of the auth instance. + To configure the provider, you need to import the provider and pass it to the `socialProviders` option of the auth instance. ```ts title="auth.ts" import { betterAuth } from "better-auth" diff --git a/docs/content/docs/authentication/google.mdx b/docs/content/docs/authentication/google.mdx index 09045de8db..c57c736445 100644 --- a/docs/content/docs/authentication/google.mdx +++ b/docs/content/docs/authentication/google.mdx @@ -11,7 +11,7 @@ description: Google Provider ### Configure the provider - To configure the provider, you need to import the provider and pass it to the `socialProvider` option of the auth instance. + To configure the provider, you need to import the provider and pass it to the `socialProviders` option of the auth instance. ```ts title="auth.ts" twoslash const process = { @@ -29,7 +29,7 @@ description: Google Provider provider: "sqlite", url: "./db.sqlite", }, - socialProvider: { // [!code highlight] + socialProviders: { // [!code highlight] google: { // [!code highlight] clientId: process.env.GOOGLE_CLIENT_ID as string, // [!code highlight] clientSecret: process.env.GOOGLE_CLIENT_SECRET as string, // [!code highlight] diff --git a/docs/content/docs/authentication/spotify.mdx b/docs/content/docs/authentication/spotify.mdx index 52380b4a82..646fbe005e 100644 --- a/docs/content/docs/authentication/spotify.mdx +++ b/docs/content/docs/authentication/spotify.mdx @@ -11,7 +11,7 @@ description: Spotify Provider ### Configure the provider - To configure the provider, you need to import the provider and pass it to the `socialProvider` option of the auth instance. + To configure the provider, you need to import the provider and pass it to the `socialProviders` option of the auth instance. ```ts title="auth.ts" twoslash const process = { @@ -29,7 +29,7 @@ description: Spotify Provider provider: "sqlite", url: "./db.sqlite", }, - socialProvider: { // [!code highlight] + socialProviders: { // [!code highlight] spotify: { // [!code highlight] clientId: process.env.SPOTIFY_CLIENT_ID as string, // [!code highlight] clientSecret: process.env.SPOTIFY_CLIENT_SECRET as string, // [!code highlight] diff --git a/docs/content/docs/authentication/twitch.mdx b/docs/content/docs/authentication/twitch.mdx index 061c87247f..e08017b198 100644 --- a/docs/content/docs/authentication/twitch.mdx +++ b/docs/content/docs/authentication/twitch.mdx @@ -11,7 +11,7 @@ description: Twitch Provider ### Configure the provider - To configure the provider, you need to import the provider and pass it to the `socialProvider` option of the auth instance. + To configure the provider, you need to import the provider and pass it to the `socialProviders` option of the auth instance. ```ts title="auth.ts" twoslash const process = { @@ -29,7 +29,7 @@ description: Twitch Provider provider: "sqlite", url: "./db.sqlite", }, - socialProvider: { // [!code highlight] + socialProviders: { // [!code highlight] twitch: { // [!code highlight] clientId: process.env.TWITCH_CLIENT_ID as string, // [!code highlight] clientSecret: process.env.TWITCH_CLIENT_SECRET as string, // [!code highlight] diff --git a/docs/content/docs/authentication/twitter.mdx b/docs/content/docs/authentication/twitter.mdx index 5d585ab70a..5f92d8b40f 100644 --- a/docs/content/docs/authentication/twitter.mdx +++ b/docs/content/docs/authentication/twitter.mdx @@ -11,7 +11,7 @@ description: Twitter Provider ### Configure the provider - To configure the provider, you need to import the provider and pass it to the `socialProvider` option of the auth instance. + To configure the provider, you need to import the provider and pass it to the `socialProviders` option of the auth instance. ```ts title="auth.ts" twoslash const process = { @@ -29,7 +29,7 @@ description: Twitter Provider provider: "sqlite", url: "./db.sqlite", }, - socialProvider: {// [!code highlight] + socialProviders: {// [!code highlight] twitter: { // [!code highlight] clientId: process.env.TWITTER_CLIENT_ID, // [!code highlight] clientSecret: process.env.TWITTER_CLIENT_SECRET, // [!code highlight] diff --git a/docs/content/docs/basic-usage.mdx b/docs/content/docs/basic-usage.mdx index df5752a0e3..4772b81f19 100644 --- a/docs/content/docs/basic-usage.mdx +++ b/docs/content/docs/basic-usage.mdx @@ -117,7 +117,7 @@ const handleSignIn = async () => { ## Social Sign-On -Better Auth supports multiple social providers, including Google, Github, Apple, Discord, and more. To use a social provider, you need to configure the ones you need in the `socialProvider` option on your `auth` object. +Better Auth supports multiple social providers, including Google, Github, Apple, Discord, and more. To use a social provider, you need to configure the ones you need in the `socialProviders` option on your `auth` object. ```ts title="auth.ts" import { betterAuth } from "better-auth" diff --git a/docs/content/docs/installation.mdx b/docs/content/docs/installation.mdx index dd8566f4bc..388130de32 100644 --- a/docs/content/docs/installation.mdx +++ b/docs/content/docs/installation.mdx @@ -133,7 +133,7 @@ export const auth = betterAuth({ emailAndPassword: { // [!code highlight] enabled: true // [!code highlight] }// [!code highlight] - socialProvider: { // [!code highlight] + socialProviders: { // [!code highlight] github: { // [!code highlight] clientId: process.env.GITHUB_CLIENT_ID, // [!code highlight] clientSecret: process.env.GITHUB_CLIENT_SECRET, // [!code highlight] diff --git a/docs/content/docs/introduction.mdx b/docs/content/docs/introduction.mdx index 4dba7941a2..efa8f9e3ee 100644 --- a/docs/content/docs/introduction.mdx +++ b/docs/content/docs/introduction.mdx @@ -3,7 +3,7 @@ title: Introduction description: Introduction to Better Auth. --- -Better Auth is framework-agnostic authentication (and authorization) library for TypeScript. It provides a comprehensive set of features out of the box and includes a plugin ecosystem that simplifies adding advanced functionalities with minimal code in short amount of time. Whether you need 2FA, multi-tenant support, or other complex features. It lets you focus on building your actual application instead of reinventing the wheel. +Better Auth is framework-agnostic authentication (and authorization) library for TypeScript. It provides a comprehensive set of features out of the box and includes a plugin ecosystem that simplifies adding advanced functionalities with minimal code with short amount of time. Whether you need 2FA, multi-tenant support, or other complex features. It lets you focus on building your actual application instead of reinventing the wheel. ## Why Better Auth?