{"id":28711730,"url":"https://github.com/curveball/next-a12n","last_synced_at":"2026-05-17T15:42:49.552Z","repository":{"id":274085848,"uuid":"921855255","full_name":"curveball/next-a12n","owner":"curveball","description":"A sample pnpm workspace using `@curveball/a12n-server` and Next.js 15","archived":false,"fork":false,"pushed_at":"2025-03-24T17:23:44.000Z","size":925,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-14T22:11:24.529Z","etag":null,"topics":["authentication","next-auth","next-auth-v5","nextjs","oauth2","oidc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/curveball.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-24T18:39:13.000Z","updated_at":"2025-05-27T19:25:41.000Z","dependencies_parsed_at":"2025-01-29T01:25:02.828Z","dependency_job_id":"20de3de4-1fa3-4898-abb0-838c7a5b2604","html_url":"https://github.com/curveball/next-a12n","commit_stats":null,"previous_names":["curveball/pnpm-example","curveball/next-a12n"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/curveball/next-a12n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curveball%2Fnext-a12n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curveball%2Fnext-a12n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curveball%2Fnext-a12n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curveball%2Fnext-a12n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/curveball","download_url":"https://codeload.github.com/curveball/next-a12n/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curveball%2Fnext-a12n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271620529,"owners_count":24791566,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["authentication","next-auth","next-auth-v5","nextjs","oauth2","oidc"],"created_at":"2025-06-14T22:10:25.286Z","updated_at":"2025-09-29T07:25:46.164Z","avatar_url":"https://github.com/curveball.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @curveball/a12n-server and Next.js\n\nThis is a simple example of how to use `@curveball/a12n-server` with a Next.js project using:\n- OAuth2 authorization code flow \n- OIDC \n- `next-auth@beta`/`authjs/dev` v5.\n\nIf you've been using `next-auth` v4, checkout their [\"Upgrade Guide (NextAuth.js v5)\"](https://authjs.dev/getting-started/migrating-to-v5).\n\nPre-requisites:\n- `pnpm` \n- node \u003e= 20\n\n## Getting Started\n\n### Install packages\n\nFrom this workspace root: \n\n`pnpm install` to install dependencies.\n\npull the latest changes for the `@curveball/a12n-server` submodule:\n\n```bash\n# initialize and update the submodule\ngit submodule init\ngit submodule update --rebase\n```\n\n### Running Local Dev Environment\n\nIn separate Terminal tabs:\n\n`pnpm start:server` to start server (will open at `http://localhost:8531/`) \n\n`pnpm start:client` will open Next at `http://localhost:3000/`\n\n`pnpm lint` to lint all projects\n\nFrom inside each project, running `pnpm \u003ccommand\u003e` for respective `package.json` scripts will also act on each project.\n\n### Environment variables\n\n`cp .env.local.example .env` to copy the default environment variables.\n\nNote: you can delete `.env.local.example` or comment out all variables in `.env.local.example` to avoid namespace conflicts while running locally.\n\nEnvironment variables prefixed with `AUTH_` are used by `authjs/next-auth`. See [\"Environment Variable Inference\"](https://authjs.dev/reference/nextjs#:~:text=next%2Dauth%40beta-,Environment%20variable%20inference,-NEXTAUTH_URL%20and%20NEXTAUTH_SECRET)\n\n\n## Setting up a12n-server\n\n### Environment variables\n\n1. Generate the server env variables\n`cd a12n-server`\n`node ./bin/a12n-server`\n\nThis creates a .env with a JWT private key and also autostarts the server.\n\nThe default settings are configured to use a sqlite database, which is fine for dev environments, but not intended for production use.\n\n2. Opening `http://localhost:8531` will prompt you to create an admin user. \n\nIf you for whatever reason lock yourself out or forget your admin password, you can start over by deleting the `a12nserver.sqlite` file.\n\n### Register a new client-side web app on `@curveball/a12n-server`\n\nFor next-auth to work, you need to obtain a OAuth2 client id and secret. \n\nTo quickly do this, you can open the following URL in your browser, which should take you through all the steps. \n\n🗒️ Make note of the `client_id` and `client_secret` values, at the end of this process.\n\n```\nhttp://localhost:8531/app/new?nickname=MyNextApp\u0026allowedGrantTypes=authorization_code,refresh_token\n\u0026redirectUris=http://localhost:3000/api/auth/callback/a12n-server\u0026url=http://localhost:3000/\u0026clientId=nextjs-app\n```\n\nOr manually create the client by following the steps below:\n\n1. Go to `http://localhost:8531/app/new` to register a new app as client. \n\n![screenshot of page for registering a new client-side application on a12n-server](./docs/img/create-new-app.png)\n\nYou will need to provide the:\n- client name (this will become known as the `nickname` on a12n-server) \n- client URL (`NEXTAUTH_URL`). \n\nThe `client_id` is used in the client to authenticate with the server.\n\nThe client URL is used to redirect the user back to the client after authentication.\n\n2. You'll be directed to configure the client.\n\n![screenshot of Edit OAuth2 Client page in a12n-server](./docs/img/add-oauth-client.png)\n  \nSelect \"authorization_code\" and \"refresh_token\" as  grant types.\n  \nFor a valid `redirectUrl` make sure you entered: `http://localhost:3000/api/auth/callback/a12n-server`\n\n1. Click \"Add\"\n\nYour client is now registered and you can use the `clientId` and `clientSecret` in your client-side app.\n\n![Screenshot of view after a new client is added with Oauth2 configurations](./docs/img/after-adding-client.png)\n\nHang onto the values of `clientId` and `clientSecret` for the next step.\n\nYou can also add more apps by selecting \"Manage Clients\" from the `a12n-server` dashboard.\n\n4. Update your `.env` file with: \n`AUTH_A12N_ID` with the value for `client_id` \n`AUTH_A12N_SECRET` with the `client_secret` value.\n\n5. Restart your client and server to continue development.\n\n## Maintenance\n\n### Updating `@curveball/a12n-server` submodule\n\nNote: this setup is intended for easy development and scaffolding. \nThis is not a recommended setup for production environments.\n\nFor first-time setup\n\n```bash\n# For first-time setup:\n# initialize and update the submodule\ngit submodule init\ngit submodule update --rebase\n\n# For updates\n# switch to the submodule directory\ncd a12n-server\n# pull the latest changes for the submodule\ngit pull origin main\n```\n\nIf you made changes and want to commit them \n\n```bash\n# return to root of project\ncd ..\n# add the submodule\ngit add a12n-server\ngit commit -m \"Update submodule\"\n## this updates the submodule in the parent repo, \n## not the original @curveball/a12n-server\ngit push origin main\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurveball%2Fnext-a12n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurveball%2Fnext-a12n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurveball%2Fnext-a12n/lists"}