{"id":21285546,"url":"https://github.com/takeyuweb/next-js-with-cookie-auth","last_synced_at":"2025-03-15T15:13:10.152Z","repository":{"id":66907445,"uuid":"246884020","full_name":"takeyuweb/next-js-with-cookie-auth","owner":"takeyuweb","description":null,"archived":false,"fork":false,"pushed_at":"2020-03-12T16:41:34.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T05:16:09.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/takeyuweb.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":"2020-03-12T16:41:22.000Z","updated_at":"2020-03-12T16:41:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4f1e095-2e9f-417d-98a8-de8c3363ba2a","html_url":"https://github.com/takeyuweb/next-js-with-cookie-auth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takeyuweb%2Fnext-js-with-cookie-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takeyuweb%2Fnext-js-with-cookie-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takeyuweb%2Fnext-js-with-cookie-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takeyuweb%2Fnext-js-with-cookie-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takeyuweb","download_url":"https://codeload.github.com/takeyuweb/next-js-with-cookie-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243746201,"owners_count":20341203,"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":[],"created_at":"2024-11-21T11:21:04.909Z","updated_at":"2025-03-15T15:13:10.130Z","avatar_url":"https://github.com/takeyuweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example app utilizing cookie-based authentication\n\nIn this example, we authenticate users and store a token in a cookie. The example only shows how the user session works, keeping a user logged in between pages.\n\nThis example is backend agnostic and uses [isomorphic-unfetch](https://www.npmjs.com/package/isomorphic-unfetch) to do the API calls on the client and the server.\n\nThe repo includes a minimal passwordless backend built with the new [API Routes support](https://github.com/zeit/next.js/pull/7296) (`pages/api`), [Micro](https://www.npmjs.com/package/micro) and the [GitHub API](https://developer.github.com/v3/). The backend allows the user to log in with their GitHub username.\n\nSession is synchronized across tabs. If you logout your session gets removed on all the windows as well. We use the HOC `withAuthSync` for this.\n\nThe helper function `auth` helps to retrieve the token across pages and redirects the user if not token was found.\n\n## Deploy your own\n\nDeploy the example using [ZEIT Now](https://zeit.co/now):\n\n[![Deploy with ZEIT Now](https://zeit.co/button)](https://zeit.co/import/project?template=https://github.com/zeit/next.js/tree/canary/examples/with-cookie-auth)\n\n## How to use\n\n### Using `create-next-app`\n\nExecute [`create-next-app`](https://github.com/zeit/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:\n\n```bash\nnpm init next-app --example with-cookie-auth with-cookie-auth-app\n# or\nyarn create next-app --example with-cookie-auth with-cookie-auth-app\n```\n\n### Download manually\n\nDownload the example [or clone the repo](https://github.com/zeit/next.js):\n\n```bash\ncurl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-cookie-auth\ncd with-cookie-auth\n```\n\n### Run locally\n\nAfter you clone the repository you can install the dependencies, run `yarn dev` and start hacking! You'll be able to see the application running locally as if it were deployed.\n\n```bash\n$ cd with-cookie-auth\n$ (with-cookie-auth/) yarn install\n$ (with-cookie-auth/) yarn dev\n```\n\n### Deploy\n\nDeploy it to the cloud with [ZEIT Now](https://zeit.co/import?filter=next.js\u0026utm_source=github\u0026utm_medium=readme\u0026utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakeyuweb%2Fnext-js-with-cookie-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakeyuweb%2Fnext-js-with-cookie-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakeyuweb%2Fnext-js-with-cookie-auth/lists"}