{"id":18248881,"url":"https://github.com/sametcn99/nextjs-cookie-based-auth","last_synced_at":"2025-04-04T15:32:36.824Z","repository":{"id":204376049,"uuid":"711699021","full_name":"sametcn99/nextjs-cookie-based-auth","owner":"sametcn99","description":"This project has been created to learn how to implement JSON Web Token (JWT) and cookie-based authentication for only an administrator (admin) using Next.js. ","archived":false,"fork":false,"pushed_at":"2024-09-18T01:10:39.000Z","size":230,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-27T13:46:48.235Z","etag":null,"topics":["admin-auth","authentication","cookies","example","next","nextjs","nextjs14","react"],"latest_commit_sha":null,"homepage":"https://nextjs-cookie-based-auth-delta.vercel.app","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/sametcn99.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-10-30T01:46:46.000Z","updated_at":"2024-06-26T23:45:16.000Z","dependencies_parsed_at":"2024-02-05T09:44:21.743Z","dependency_job_id":null,"html_url":"https://github.com/sametcn99/nextjs-cookie-based-auth","commit_stats":null,"previous_names":["sametcn99/nextjs-cookie-based-auth"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcn99%2Fnextjs-cookie-based-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcn99%2Fnextjs-cookie-based-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcn99%2Fnextjs-cookie-based-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcn99%2Fnextjs-cookie-based-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sametcn99","download_url":"https://codeload.github.com/sametcn99/nextjs-cookie-based-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247203129,"owners_count":20900920,"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":["admin-auth","authentication","cookies","example","next","nextjs","nextjs14","react"],"created_at":"2024-11-05T09:38:35.653Z","updated_at":"2025-04-04T15:32:31.816Z","avatar_url":"https://github.com/sametcn99.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next.js JWT and Cookie-Based Admin Authentication Example\n\nThis project has been created to learn how to implement JSON Web Token (JWT) and cookie-based authentication for only an administrator (admin) using [Next.js](https://nextjs.org/). The project includes a homepage that requires only users identified as administrators to log in. Users can log in using JWT tokens and cookies.\n\n## Project Setup\n\nTo enable JWT and cookie-based authentication in this project, we use the following environment variables. You should set these environment variables in the `.env` file:\n\n1. `NEXT_PUBLIC_ADMIN_SECRET`: A variable that contains the password used for admin login. This value is compared to create a JWT token and stored as a cookie.\n\n2. `NEXT_PUBLIC_JWT_SECRET_KEY`: A secret key used to sign and verify JWT tokens. This key ensures the security of JWT tokens.\n\n\n3. To start the project, run the following commands; `npm i` and `npm run dev`:\n\n4. Visit `http://localhost:3000` in your web browser. The homepage will appear.\n\n5. Click the \"Log In\" button on the homepage to log in as a user identified as an administrator. You should log in using the `NEXT_PUBLIC_ADMIN_SECRET` value you've set earlier.\n\n6. After a successful login, you will be redirected to the administrator page.\n\n## Further Information\n\nThe purpose of this project is to learn the fundamental concepts of implementing JWT and cookie-based authentication for only administrator users using Next.js. By examining the project, you can learn how to grant access to specific areas that require a certain level of authentication.\n\nIf you wish to customize the project and add more features, you can refer to the official Next.js documentation and other resources related to JWT.\n\n##\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsametcn99%2Fnextjs-cookie-based-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsametcn99%2Fnextjs-cookie-based-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsametcn99%2Fnextjs-cookie-based-auth/lists"}