Registry / security / fayda
library0.0.14jsnpmunverified

Better Auth plugin integrating Fayda (Ethiopian national digital ID) OAuth2 authentication. Current stable version is 0.0.14, released with monthly cadence. It provides client ID and private key configuration, automatic account linking via better-auth, and requires proper redirect URL setup. Key differentiator: bridges Ethiopian national ID system with the better-auth ecosystem, enabling domestic authentication flows. Requires better-auth ^1.3.4 as a peer dependency.

npm install fayda
INSTALL
IMPORT
SIG · FAYDA
F
fayda
securityjavascriptv0.0.14
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fayda
import { fayda } from 'fayda'
import fayda from 'fayda'
Named import only; default export is not available.
fayda (require)
const { fayda } = require('fayda')
const fayda = require('fayda')
CJS pattern requires destructuring.
genericOAuthClient
import { genericOAuthClient } from 'better-auth/client/plugins'
Used on the client side; must be imported from the client plugins path.

Configures better-auth with the Fayda plugin, sets up client-side OAuth, and triggers sign-in flow.

import { fayda } from 'fayda'; import { betterAuth } from 'better-auth'; export const auth = betterAuth({ plugins: [ fayda({ clientId: process.env.FAYDA_CLIENT_ID ?? '', privateKey: process.env.FAYDA_PRIVATE_KEY ?? '', }) ], account: { accountLinking: { enabled: true, trustedProviders: ['fayda'] } } }); // Client-side (Svelte example) import { createAuthClient } from 'better-auth/svelte'; import { genericOAuthClient } from 'better-auth/client/plugins'; export const authClient = createAuthClient({ baseURL: 'http://localhost:3000', plugins: [genericOAuthClient()] }); // Sign in authClient.signIn.oauth2({ providerId: 'fayda' });
Debug
Known issues
gotcharedirectURL must be set to <baseUrl>/api/auth/oauth2/callback/fayda in Fayda dashboard; otherwise authentication will fail.
fix
Configure your Fayda client's redirectURL to exactly your base URL plus `/api/auth/oauth2/callback/fayda`.
affects: >=0.0.1
breakingDevelopment callback URLs cannot be used directly; a redirector is required.
fix
Implement a server-side redirect (e.g., SvelteKit endpoint) that forwards callbacks to the correct better-auth handler.
affects: >=0.0.1
deprecatedUsing default export import pattern is deprecated; only named export is supported.
fix
Use named import: import { fayda } from 'fayda' instead of import fayda from 'fayda'.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: fayda is not a function
Used default import instead of named import.
fix
Change to: import { fayda } from 'fayda'
Error: Invalid OAuth callback URL
The redirectURL configured in Fayda does not match the exact expected path.
fix
Set redirectURL to `<baseUrl>/api/auth/oauth2/callback/fayda` exactly.
Error: Account linking disabled for provider 'fayda'
accountLinking.enabled is not set to true or fayda is not in trustedProviders.
fix
Add account: { accountLinking: { enabled: true, trustedProviders: ['fayda'] } } to betterAuth config.
Upgrade
Version history
0.0.14latest on npm
Audit
Dependencies
better-authrequiredpeer dependency required for plugin registration and OAuth flow
Agent activity
16 hits · last 30 days
node
14
Amazon
1
Resources
packagefayda
fayda — npm install fayda · libregistry