{"id":19972601,"url":"https://github.com/jpb06/auth0-silent-login","last_synced_at":"2026-06-05T13:31:55.344Z","repository":{"id":245471566,"uuid":"818323054","full_name":"jpb06/auth0-silent-login","owner":"jpb06","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-24T19:32:25.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T20:31:10.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpb06.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-06-21T15:33:10.000Z","updated_at":"2025-03-24T19:32:26.000Z","dependencies_parsed_at":"2024-06-22T09:15:57.136Z","dependency_job_id":"eefd2a92-4d29-4f7c-9f34-8102ce4fc6b0","html_url":"https://github.com/jpb06/auth0-silent-login","commit_stats":null,"previous_names":["jpb06/auth0-silent-login"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jpb06/auth0-silent-login","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fauth0-silent-login","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fauth0-silent-login/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fauth0-silent-login/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fauth0-silent-login/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpb06","download_url":"https://codeload.github.com/jpb06/auth0-silent-login/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpb06%2Fauth0-silent-login/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33944671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"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":[],"created_at":"2024-11-13T03:08:39.222Z","updated_at":"2026-06-05T13:31:55.336Z","avatar_url":"https://github.com/jpb06.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# auth0 silent login + nextjs\n\nThis is a reproduction repo for the following workflow requirement on auth0:\n\n- Create a user.\n- Silently log him in (the user typed his password once when entering his infos, we don't want to ask him again for credentials or prompt him for a consent).\n- redirect him to a page on a nextjs app that requires a session.\n\n## Workflow Steps\n\n- Front - [Signup form](./src/app/page.tsx) - Have a form that targets a next server action. In real world we would have form data submitted to the action (email, password, etc..).\n- Backend - [User creation](./src/server/auth0/create-user.ts) - User creation on auth0 user database using `auth0` node library.\n- Backend - [Silent login](./src/server/auth0/silent-login.ts) - calling `/oauth/token` to retrieve an `id_token` and an `access_token`.\n- Backend - [Session payload](./src/server/auth0/nextjs/get-session-payload.ts) - Generate a payload for the session to be stored on one or several cookies, depending on payload size.\n- Backend - [Encrypt payload](./src/server/auth0/nextjs/encrypt.ts) - Encrypt the session payload using auth0 secret [generated earlier](https://github.com/auth0/nextjs-auth0?tab=readme-ov-file#getting-started).\n- Backend - [Cookie creation](./src/server/auth0/nextjs/set-session-cookie.ts) - Set session cookie.\n- Backend - [Redirect](./src/app/_server/create-user-and-silent-login.action.ts) - Finally, redirect to `/`.\n- Frontend - [User is logged in](./src/app/_client/User.tsx) - See the user as logged in, per `@auth0/nextjs-auth0`.\n\n## Encountered issues\n\n### Logic redefinition\n\nWe essentially extracted logic from [nextjs-auth0](https://github.com/auth0/nextjs-auth0/blob/951a24864c61eec98702f91eb7784555d54916da/src/auth0-session/session/stateless-session.ts#L127):\n\n- [Session payload definition](./src/server/auth0/nextjs/get-session-payload.ts)\n- [Session payload encryption](./src/server/auth0/nextjs/encrypt.ts)\n- [Cookies creation](./src/server/auth0/nextjs/set-session-cookie.ts)\n\nIdeally, we would have preferred to use `nextjs-auth0` code for this, as redefining this logic in our own codebase exposes us to a regression risk if the logic changes in `nextjs-auth0` lib.\n\n### Redirect + set cookie\n\nWhen we redirect after setting a cookie, we have to do a client side refresh on the page; otherwise, the session will not be present client side.\n\nSee [48434](https://github.com/vercel/next.js/discussions/48434#discussioncomment-9216776)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpb06%2Fauth0-silent-login","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpb06%2Fauth0-silent-login","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpb06%2Fauth0-silent-login/lists"}