{"_id":"@doncicuto/remix-auth-gitea","_rev":"1-3db642a0704f136900c22d55c7dab08e","name":"@doncicuto/remix-auth-gitea","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@doncicuto/remix-auth-gitea","version":"1.0.0","main":"./build/index.js","types":"./build/index.d.ts","scripts":{"build":"tsc --project tsconfig.json","typecheck":"tsc --project tsconfig.json --noEmit","lint":"eslint --ext .ts,.tsx src/","test":"jest --config=config/jest.config.ts --passWithNoTests","coverage":"npm run test -- --coverage"},"keywords":["remix","remix-auth","auth","authentication","strategy","gitea-auth"],"author":{"name":"Miguel Cabrerizo","email":"doncicuto@gmail.com","url":"https://github.com/doncicuto"},"repository":{"url":"git+https://github.com/doncicuto/remix-auth-gitea.git","type":"git"},"license":"MIT","peerDependencies":{"@remix-run/server-runtime":"^1.1.1","remix-auth":"^3.2.1"},"devDependencies":{"@babel/core":"^7.14.2","@babel/preset-env":"^7.14.1","@babel/preset-react":"^7.13.13","@babel/preset-typescript":"^7.13.0","@remix-run/node":"^1.1.1","@remix-run/react":"^1.1.1","@remix-run/server-runtime":"^1.0.0","@types/debug":"^4.1.7","@types/jest":"^26.0.23","@typescript-eslint/eslint-plugin":"^4.23.0","@typescript-eslint/parser":"^4.23.0","babel-jest":"^26.6.3","eslint":"^7.26.0","eslint-config-prettier":"^8.3.0","eslint-plugin-jest":"^24.3.6","eslint-plugin-jest-dom":"^3.9.0","eslint-plugin-prettier":"^3.4.0","eslint-plugin-unicorn":"^32.0.1","jest":"^26.6.3","jest-fetch-mock":"^3.0.3","prettier":"^2.3.2","react":"^17.0.2","ts-node":"^9.1.1","typescript":"^4.3.5"},"dependencies":{"@headlessui/react":"^1.4.3","debug":"^4.3.3","remix-auth":"^3.2.1","remix-auth-oauth2":"^1.2.0"},"gitHead":"cd266565d339b07a613814d17db5e304a12872fa","description":"The Gitea strategy for [remix-auth](https://github.com/sergiodxa/remix-auth) is used to authenticate users against a Gitea account. It extends the OAuth2Strategy.","bugs":{"url":"https://github.com/doncicuto/remix-auth-gitea/issues"},"homepage":"https://github.com/doncicuto/remix-auth-gitea#readme","_id":"@doncicuto/remix-auth-gitea@1.0.0","_nodeVersion":"14.18.3","_npmVersion":"6.14.15","dist":{"integrity":"sha512-FnjWjczJKnKfuv6DKgzC7MyayClyIVSREyOj3D1baf05qYCiBizELiausP2y2vO8baMz64ZrY0wxuv+yeum4mA==","shasum":"2f0a3982122b7abc993beea9ebf13b030286005a","tarball":"https://registry.npmjs.org/@doncicuto/remix-auth-gitea/-/remix-auth-gitea-1.0.0.tgz","fileCount":5,"unpackedSize":10119,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/kKpCRA9TVsSAnZWagAAES0P/0SMnSVJj1Bzd6niF//f\n+gCD+e0nTWbDSaHr+7KIJfZ3Gjnee0+f76X0SSvQ7SrnsPhJEJ7G863E/JBQ\nf5iteUPsu9J+zHzFoDdxXtX03qDCpD9v/Wh76UfVnAw3IPNK6f5m4mmbzSjK\ntftEruAU3Hh2n1IoHlwXZovBbmnuM2IcPhz+DEufqk4LIrG3y9rpajwaSxNn\nHix+F5wcaBM5hltUTZbf6pPgJo6hCSW+MX8MYOdIQ67W5dQgXE9I/Cs+ma3C\nduP0I0WBFfNjI/96+a05g7rXt4JtZlwv50vtceblCZAPW++au106WN1TKLUt\nLC01l2898ZnLEItcOrb7UHmnKXOgr+BJUluIjn6Q8CW1z5X1hLJpSzzE2jqT\nVV6P1FUNDh9mqfjC3kfl/2aNJjiQjoGv5NDZnbski/lWCI+Y3g9KKCfwJ04C\nDw5B0ibHG+aQy/IuKiOr2sgQyzBPZ5iiOUACA6qn9a/EmSGSumqEE7gKnXN0\nrtRjphSkxDhCDXfL01suu2oYCzBS9n04+HlGaFlk9we8xnA7CUotSx+ADtkD\nE6dOysm/T6v0wWaU6ef/3upD5Qgq2MoMWYOYIoAs6W9VI8MqMDHO5ZM9OT4w\nlSC1LbLquDMIqIbG2YEuYfT5Dtfm8u/FGY4Y8nz2DGfUq/+nM2WcS+lCc1KA\n11h3\r\n=hGNQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFFC1TEDCwj+iAwkGnEU/AHrjSOpkm04ezUMpwqAKswrAiEA6J4OeU7gbEysc05VnUyp8wqhiPu43ictNwSSQwnRUnk="}]},"_npmUser":{"name":"mcabrerizo","email":"mcabrerizo@arrakis.ovh"},"directories":{},"maintainers":[{"name":"mcabrerizo","email":"mcabrerizo@arrakis.ovh"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/remix-auth-gitea_1.0.0_1644053161679_0.17313892734634617"},"_hasShrinkwrap":false}},"time":{"created":"2022-02-05T09:26:01.614Z","1.0.0":"2022-02-05T09:26:01.842Z","modified":"2022-04-05T05:15:09.707Z"},"maintainers":[{"name":"mcabrerizo","email":"mcabrerizo@arrakis.ovh"}],"description":"The Gitea strategy for [remix-auth](https://github.com/sergiodxa/remix-auth) is used to authenticate users against a Gitea account. It extends the OAuth2Strategy.","homepage":"https://github.com/doncicuto/remix-auth-gitea#readme","keywords":["remix","remix-auth","auth","authentication","strategy","gitea-auth"],"repository":{"url":"git+https://github.com/doncicuto/remix-auth-gitea.git","type":"git"},"author":{"name":"Miguel Cabrerizo","email":"doncicuto@gmail.com","url":"https://github.com/doncicuto"},"bugs":{"url":"https://github.com/doncicuto/remix-auth-gitea/issues"},"license":"MIT","readme":"# GiteaStrategy\n\nThe Gitea strategy for [remix-auth](https://github.com/sergiodxa/remix-auth) is used to authenticate users against a Gitea account. It extends the OAuth2Strategy.\n\nThe domain for our Gitea server including protocol and port must be specified. Example: `https://example.com:3000`\n\n## Supported runtimes\n\n| Runtime    | Has Support |\n| ---------- | ----------- |\n| Node.js    | ✅          |\n| Cloudflare | ✅          |\n\n## Usage\n\n### Create an OAuth application\n\nFollow the steps on [the Gitea documentation](https://docs.gitea.io/en-us/oauth2-provider/) to create a new application and get a client ID and secret.\n\n### Create the strategy instance\n\n```ts\nimport { GiteaStrategy } from \"remix-auth-gitea\";\n\nlet giteaStrategy = new GiteaStrategy(\n  {\n    clientID: \"YOUR_CLIENT_ID\",\n    clientSecret: \"YOUR_CLIENT_SECRET\",\n    callbackURL: \"https://example.com/auth/gitea/callback\",\n    domain: \"http://example.com:3000\", \n  },\n  async ({ accessToken, extraParams, profile }) => {\n    // Get the user data from your DB or API using the tokens and profile\n    return User.findOrCreate({ email: profile.emails[0].value });\n  }\n);\n\nauthenticator.use(giteaStrategy);\n```\n\n### Setup your routes\n\n```tsx\n// app/routes/login.tsx\nexport default function Login() {\n  return (\n    <Form action=\"/auth/gitea\" method=\"post\">\n      <button>Login with Gitea</button>\n    </Form>\n  );\n}\n```\n\n```tsx\n// app/routes/auth/gitea.tsx\nimport { ActionFunction, LoaderFunction, redirect } from \"remix\";\nimport { authenticator } from \"~/auth.server\";\n\nexport let loader: LoaderFunction = () => redirect(\"/login\");\n\nexport let action: ActionFunction = ({ request }) => {\n  return authenticator.authenticate(\"gitea\", request);\n};\n```\n\n```tsx\n// app/routes/auth/gitea/callback.tsx\nimport { LoaderFunction } from \"remix\";\nimport { authenticator } from \"~/auth.server\";\n\nexport let loader: LoaderFunction = ({ request }) => {\n  return authenticator.authenticate(\"gitea\", request, {\n    successRedirect: \"/dashboard\",\n    failureRedirect: \"/login\",\n  });\n};\n```\n\n### Aknowledgements\n\n[@sergiodxa](https://github.com/sergiodxa): for [remix-auth](https://github.com/sergiodxa/remix-auth), [remix-auth-strategy-template](https://github.com/sergiodxa/remix-auth-strategy-template) and for so many repositories and blog posts that make Remix easier to use and learn.\n","readmeFilename":"README.md"}