{"id":24129566,"url":"https://github.com/luandro/comunidade-servidor-ui","last_synced_at":"2025-06-25T16:07:49.894Z","repository":{"id":79813207,"uuid":"182527674","full_name":"luandro/comunidade-servidor-ui","owner":"luandro","description":null,"archived":false,"fork":false,"pushed_at":"2019-04-24T19:06:19.000Z","size":85,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T05:18:39.456Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/luandro.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":"2019-04-21T12:03:24.000Z","updated_at":"2019-04-24T19:06:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"929f9acb-f7ee-4938-a109-53b4b00cf530","html_url":"https://github.com/luandro/comunidade-servidor-ui","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luandro/comunidade-servidor-ui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fcomunidade-servidor-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fcomunidade-servidor-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fcomunidade-servidor-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fcomunidade-servidor-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luandro","download_url":"https://codeload.github.com/luandro/comunidade-servidor-ui/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fcomunidade-servidor-ui/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261906853,"owners_count":23228357,"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":"2025-01-11T19:33:50.798Z","updated_at":"2025-06-25T16:07:49.857Z","avatar_url":"https://github.com/luandro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-cookie-auth)\n\n# Example app utilizing cookie-based authentication\n\n## How to use\n\n### Using `create-next-app`\n\nDownload [`create-next-app`](https://github.com/segmentio/create-next-app) to bootstrap the example:\n\n```\nnpm i -g create-next-app\ncreate-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\nThe repository is setup as a [monorepo](https://zeit.co/examples/monorepo/) so you can deploy it easily running `now` inside the project folder. However, you can't run it the same way locally (yet).\n\nThese files make it easier to run the application locally and aren't needed for production:\n\n- `/api/index.js` runs the API server on port `3001` and imports the `login` and `profile` microservices.\n- `/www/server.js` runs the Next.js app with a custom server proxying the authentication requests to the API server. We use this so we don't modify the logic on the application and we don't have to deal with CORS if we use domains while testing.\n\nInstall and run the API server:\n\n```bash\ncd api\nnpm install\nnpm run dev\n```\n\nThen run the Next.js app:\n\n```bash\ncd ../www\nnpm install\nnpm run dev\n```\n\n### Deploy\n\nDeploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))\n\n```bash\nnow\n```\n\n## The idea behind the example\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 [Micro](https://www.npmjs.com/package/micro) that logs the user in with a GitHub username and saves the user id from the API call as token.\n\nSession is syncronized across tabs. If you logout your session gets logged out 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluandro%2Fcomunidade-servidor-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluandro%2Fcomunidade-servidor-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluandro%2Fcomunidade-servidor-ui/lists"}