{"id":39031734,"url":"https://github.com/frectonz/fayda","last_synced_at":"2026-01-17T17:40:32.992Z","repository":{"id":307874236,"uuid":"1030961865","full_name":"frectonz/fayda","owner":"frectonz","description":"Better Auth plugin for Fayda.","archived":false,"fork":false,"pushed_at":"2025-08-02T19:42:25.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-02T19:43:30.448Z","etag":null,"topics":["better-auth","fayda"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frectonz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-02T17:50:51.000Z","updated_at":"2025-08-02T19:40:37.000Z","dependencies_parsed_at":"2025-08-02T19:54:07.178Z","dependency_job_id":null,"html_url":"https://github.com/frectonz/fayda","commit_stats":null,"previous_names":["frectonz/fayda"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/frectonz/fayda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Ffayda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Ffayda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Ffayda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Ffayda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frectonz","download_url":"https://codeload.github.com/frectonz/fayda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Ffayda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28513944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["better-auth","fayda"],"created_at":"2026-01-17T17:40:32.845Z","updated_at":"2026-01-17T17:40:32.970Z","avatar_url":"https://github.com/frectonz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Better Auth Fayda Plugin\n\nBetter Auth plugin for Fayda.\n\n## Installation\n\nYou can install the plugin using `pnpm`, `npm`, or `yarn`.\n\n```\npnpm add fayda\n```\n\n## Auth Configuration\n\nTo use the plugin, you need to add it to your `better-auth` plugin list. Ensure you set the `accountLinking` options to link the user's Fayda identity with their local account.\n\nThe `clientId` and `privateKey` should be loaded from your environment variables.\n\n```ts\nimport { fayda } from 'fayda';\nimport { betterAuth } from 'better-auth';\n\nexport const auth = betterAuth({\n\t// ...\n\tplugins: [\n\t\t// ...\n\t\tawait fayda({\n\t\t\tclientId: env.CLIENT_ID,\n\t\t\tprivateKey: env.PRIVATE_KEY,\n\t\t})\n\t],\n\taccount: {\n\t\taccountLinking: {\n\t\t\tenabled: true,\n\t\t\ttrustedProviders: ['fayda']\n\t\t}\n\t}\n});\n```\n\n### Redirect Configuration\n\n**IMPORTANT**: The `clientId` you receive from Fayda must have its `redirectURL` configured to `\u003cbaseUrl\u003e/api/auth/oauth2/callback/fayda` where `\u003cbaseUrl\u003e` is the address of your application like `https://example.com`.\n\nIf you are using a development `clientId` and need to use a different `callbackUrl` (e.g., `http://localhost:3000/callback`), you will need to set up a redirector. This redirector will accept the request and forward it to the correct better-auth callback handler.\n\nBelow is a `SvelteKit` example of how to implement this redirect. In this example, if your `callbackURL` is `http://localhost:3000/callback`, you would place this code in `src/routes/callback/+page.server.ts`.\n\n```ts\nimport { redirect } from '@sveltejs/kit';\nimport type { PageServerLoad } from './$types';\n\nexport const load: PageServerLoad = async (req) =\u003e {\n\tconst originalUrl = new URL(req.url, `http://localhost:3000`);\n\tconst target = new URL('http://localhost:3000/api/auth/oauth2/callback/fayda');\n\ttarget.search = originalUrl.search;\n\n\tredirect(302, target);\n};\n```\n\n## Auth Configuration\n\nNext, you need to add the generic OAuth client plugin to your client-side authentication configuration. This will enable the client to initiate the OAuth flow with the Fayda provider.\n\n```ts\nimport { createAuthClient } from 'better-auth/svelte';\nimport { genericOAuthClient } from 'better-auth/client/plugins';\n\nexport const authClient = createAuthClient({\n\tbaseURL: 'http://localhost:3000',\n\tplugins: [genericOAuthClient()]\n});\n```\n\nOnce the client is configured, you can use the `signIn.oauth2` method to start the authentication flow.\n\n```ts\nauthClient.signIn.oauth2({\n\tproviderId: 'fayda',\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrectonz%2Ffayda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrectonz%2Ffayda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrectonz%2Ffayda/lists"}