{"id":25923932,"url":"https://github.com/thomasbuilds/start-oauth","last_synced_at":"2025-03-03T17:19:13.887Z","repository":{"id":238093806,"uuid":"795876548","full_name":"thomasbuilds/start-oauth","owner":"thomasbuilds","description":"Most efficient OAuth for SolidStart","archived":false,"fork":false,"pushed_at":"2024-05-07T18:17:26.000Z","size":9,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T10:04:29.305Z","etag":null,"topics":["npm-package","oauth2","solid-js","solid-start"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/start-oauth","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/thomasbuilds.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2024-05-04T10:13:19.000Z","updated_at":"2024-09-30T12:24:39.000Z","dependencies_parsed_at":"2024-05-07T19:42:22.958Z","dependency_job_id":null,"html_url":"https://github.com/thomasbuilds/start-oauth","commit_stats":null,"previous_names":["thomasbuilds/start-oauth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasbuilds%2Fstart-oauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasbuilds%2Fstart-oauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasbuilds%2Fstart-oauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasbuilds%2Fstart-oauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasbuilds","download_url":"https://codeload.github.com/thomasbuilds/start-oauth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241705918,"owners_count":20006399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["npm-package","oauth2","solid-js","solid-start"],"created_at":"2025-03-03T17:19:13.267Z","updated_at":"2025-03-03T17:19:13.877Z","avatar_url":"https://github.com/thomasbuilds.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OAuth2 for SolidStart\n\n[![NPM](https://img.shields.io/npm/v/start-oauth.svg)](https://www.npmjs.com/package/start-oauth)\n\nThis package returns the `name`, `email` and `image` of user authenticated through third party services (supporting Discord, GitHub, Google and Spotify as of now).\n\n## Installation\n\n```bash\n# npm\nnpm install start-oauth\n\n# pnpm\npnpm add start-oauth\n```\n\n## Configuration\n\n```ts\n//MUST BE api/oauth/[...oauth].ts\nimport OAuth, { type Configuration } from \"start-oauth\";\n\nconst configuration: Configuration = {\n  google: {\n    id: process.env.GOOGLE_ID as string,\n    secret: process.env.GOOGLE_SECRET as string,\n    state: process.env.STATE, //optional XSRF protection\n  },\n  async handler(user, redirect) {\n    //create user session\n  },\n};\n\nexport const GET = OAuth(configuration);\n```\n\n- In case of error, you are redirected to page requesting login and `error` parameter specifies reason.\n- Adding a `redirect` search parameter on page requesting login gives you access to the value on handler function.\n\n```tsx\n//login.tsx for example\nexport default function Login() {\n  const requestLogin = useOAuthLogin();\n\n  return (\n    \u003cdiv\u003e\n      \u003ca href={requestLogin(\"google\")} rel=\"external\"\u003e\n        \u003cGoogleIcon /\u003e\n      \u003c/a\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\nThe package doesn’t provide the session management.\nThis gives you complete control over redirections and you can seamlessly integrate multiple authentication methods sharing the same logic.\n\n## Contributions\n\nPlease open issues for bugs and we much appreciate contributions for more provider support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasbuilds%2Fstart-oauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasbuilds%2Fstart-oauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasbuilds%2Fstart-oauth/lists"}