Package Exports
- better-auth-zoho
- better-auth-zoho/package.json
Readme

better-auth-zoho
Zoho Provider for Better-Auth. Wrapper around Generic OAuth plugin.
This package allow you to easily add Zoho OpenID Connect (OIDC) flow to your application.
Installation
npm i better-auth-zoho
Zoho Setup
- Go to Zoho API Console
- Login with your Zoho Account
- Create a
Server Based Application
- Paste these details
# For Local Development
Client Name: MyApp
Homepage URL: http://localhost:3000
Authorized Redirect URIs: http://localhost:3000/api/auth/oauth2/callback/zoho
- Copy credentials to your
.env
file
ZOHO_CLIENT_ID="*****************"
ZOHO_CLIENT_SECRET="*************"
Usage
import { betterAuth } from "better-auth";
import { zohoPlugin } from "better-auth-zoho";
export const auth = betterAuth({
plugins: [
zohoPlugin({
location: "in" // App DataCenter
}),
],
});
Client Side
import { createAuthClient } from "better-auth/client"
import { genericOAuthClient } from "better-auth/client/plugins"
import type { auth } from "./auth";
export const authClient = createAuthClient({
plugins: [
inferAdditionalFields<typeof auth>(), // optional
genericOAuthClient() // required
]
})
import { authClient } from "./lib/auth";
await authClient.signIn.oauth2({
providerId: "zoho"
});
Advanced Config
import { betterAuth } from "better-auth";
import { genericOAuth } from "better-auth/plugins";
import { zoho } from "better-auth-zoho";
export const auth = betterAuth({
plugins: [
genericOAuth({
config: [
zoho({
// 'in' for India DC (https://accounts.zoho.in)
// 'us' for United States DC (https://accounts.zoho.com)
location: "in",
scopes: ["email", "phone", "profile", "openid"],
clientId: process.env.ZOHO_CLIENT_ID,
clientSecret: process.env.ZOHO_CLIENT_SECRET
}),
// Add more providers as needed
]
}),
],
});
Resources
Make sure to read docs from Zoho OAuth before setup.