{"id":18772637,"url":"https://github.com/authgear/authgear-example-nextjs","last_synced_at":"2025-04-13T08:31:49.130Z","repository":{"id":189136981,"uuid":"679604795","full_name":"authgear/authgear-example-nextjs","owner":"authgear","description":"Add authentication for Next.js app using Authgear","archived":false,"fork":false,"pushed_at":"2024-03-19T13:11:37.000Z","size":88,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-27T00:22:57.862Z","etag":null,"topics":["authentication","authgear","nextjs","openid-connect","react","typescript"],"latest_commit_sha":null,"homepage":"https://www.authgear.com/","language":"JavaScript","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/authgear.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}},"created_at":"2023-08-17T07:59:22.000Z","updated_at":"2024-08-22T03:42:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"d804beb3-ec3f-4889-9af6-787e11ccf6e0","html_url":"https://github.com/authgear/authgear-example-nextjs","commit_stats":null,"previous_names":["authgear/authgear-example-nextjs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authgear%2Fauthgear-example-nextjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authgear%2Fauthgear-example-nextjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authgear%2Fauthgear-example-nextjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authgear%2Fauthgear-example-nextjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/authgear","download_url":"https://codeload.github.com/authgear/authgear-example-nextjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248684317,"owners_count":21145056,"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":["authentication","authgear","nextjs","openid-connect","react","typescript"],"created_at":"2024-11-07T19:29:47.316Z","updated_at":"2025-04-13T08:31:48.844Z","avatar_url":"https://github.com/authgear.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Add authentication for Next.js app using Authgear and OpenID Connect\n\nThis repo demonstrates how to integrate [Authgear](https://www.authgear.com/) with [Next.js App](https://next-auth.js.org/), and [NextAuth.js](https://next-auth.js.org/) client library is used for sending authentication requests as an OpenID Connect middleware from the app to Authgear.\n\n## What is Authgear?\n\n[Authgear](https://www.authgear.com/) acts as an IAM provider that is a **gatekeeper to the resources** you provide to customers as web and mobile applications, APIs, etc. The gatekeeper initiates authorization as outlined in [OAuth 2.0](https://www.notion.so/concepts/identity-fundamentals#oauth-2.0). The addition of the [OpenID Connect](https://www.notion.so/concepts/identity-fundamentals#open-id-connect) layer adds authentication to secure your users’ digital identities and your product.\n\n## How to run the project\n\n## Prerequisites\n\nBefore you begin, you'll need the following:\n\n- A **free Authgear account**. [Sign up](https://portal.authgear.com) if you don't have one already.\n- [Node.js](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).\n- Experience with [Next.js](https://nextjs.org/) framework and application development.\n\nOn the Authgear portal, you shall create an OIDC client by:\n\n1. Click **Applications**, **Add Application**, choose **OIDC Client Application** to create the Application.\n2. Put `http://localhost:3000/api/auth/callback/authgear` in **Authorized Redirect URIs**.\n\nStart by cloning the project into your local machine:\n\n```bash\ngit clone https://github.com/authgear/authgear-example-nextjs.git\n```\n\nMake the project directory your current working directory:\n\n```bash\ncd authgear-example-nextjs\n```\n\nIn the root directory of your project, add the file `.env.local` with the following environment variables:\n\n```jsx\nAUTHGEAR_ISSUER={your-authgear-app-endpoint, e.g. https://yourname.authgear.cloud}\nAUTHGEAR_CLIENT_ID={your-client-id}\nAUTHGEAR_CLIENT_SECRET={your-client-secret}\n```\n\nReplace values with your Authgear OIDC Client application settings such as `Issuer`, `ClientId`, `ClientSecret`.\n\nTo install project dependencies run:\n```bash\nnpm install\n```\n\nStart the HTTP server by running the following command.\n\n```bash\nnpm run dev\n```\n\nBrowse to [localhost:3000](http://localhost:3000/). If the installation went successful, you should see the Login page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthgear%2Fauthgear-example-nextjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthgear%2Fauthgear-example-nextjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthgear%2Fauthgear-example-nextjs/lists"}