{"id":13343686,"url":"https://github.com/lukehansell/redux-token-passing-example","last_synced_at":"2026-04-13T05:33:00.956Z","repository":{"id":90235892,"uuid":"149588924","full_name":"lukehansell/redux-token-passing-example","owner":"lukehansell","description":"using Redux and Auth0 together with Zeit Next.js","archived":false,"fork":false,"pushed_at":"2018-09-20T15:50:26.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-03T05:42:03.446Z","etag":null,"topics":["auth0","functional-programming","higher-order-component","nextjs","react","redux","zeit"],"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/lukehansell.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":"2018-09-20T09:59:21.000Z","updated_at":"2018-09-20T15:50:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"2121de18-f847-49f1-bdea-77aa1793189b","html_url":"https://github.com/lukehansell/redux-token-passing-example","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/lukehansell%2Fredux-token-passing-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukehansell%2Fredux-token-passing-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukehansell%2Fredux-token-passing-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukehansell%2Fredux-token-passing-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukehansell","download_url":"https://codeload.github.com/lukehansell/redux-token-passing-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244902924,"owners_count":20529115,"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":["auth0","functional-programming","higher-order-component","nextjs","react","redux","zeit"],"created_at":"2024-07-29T19:31:56.990Z","updated_at":"2025-12-30T23:52:40.323Z","avatar_url":"https://github.com/lukehansell.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Example of using Auth0 with Redux to pass tokens for authentication.\n\n#installing\n- clone this repo\n- `npm i` or use `tink` etc.\n- rename `next.config.sample.js` to `next.config.js` and update the settings\n- run `npm run dev` for dev environment\n\n\n#what does each bit do?\n`/lib/AuthService` is a wrapped around Auth0's SDK.\n`/components` is designed to be display only.\n`/hocs` provides higher order functions and components\n - `withLoggedInFlag` provides the `loggedIn` prop derived from the redux state\n - `withLoginAction` provides the `login` prop function which dispatches the `login` action\n - `withLoginAttemptAction` provides the `loginAttempt` prop function with dispatches the `loginAttempt` action\n - `withReduxStore` instantiates a redux store and passes it as a prop to the wrapped components\n`pages` provides Next.js' page components \n - `_app` instantiates the redux store and sets up the containers and context for use by the hocs\n - `callback` is called as part of the Auth0 setup and calls the login attempt action to let redux know that an attempt to login has been made\n - `index` provides with the login button or a message saying hi\n - \n\nother notable bits are the actions, reducer and store.\nThe only bit that's of any consequence is the actions.\nThe `loginAttempt` action will authenticate a hash and return either a successful or error state for an Auth0 login.\nThat's how we know people have logged in or not.\n\nThe `login` action uses the AuthService lib to call off to the auth SaaS to attempt a login handshake.\n\n#todo\n- persist tokens over page refreshes\n- send token to the server for server rendering of authenticated routes","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukehansell%2Fredux-token-passing-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukehansell%2Fredux-token-passing-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukehansell%2Fredux-token-passing-example/lists"}