{"id":17498195,"url":"https://github.com/timreynolds/firebase-authentication-for-nextjs-with-apollo","last_synced_at":"2025-04-23T01:56:30.686Z","repository":{"id":40949410,"uuid":"173301796","full_name":"timReynolds/firebase-authentication-for-nextjs-with-apollo","owner":"timReynolds","description":"An example of authentication with firebase with Next.JS and Apollo","archived":false,"fork":false,"pushed_at":"2023-01-09T11:40:06.000Z","size":1256,"stargazers_count":7,"open_issues_count":35,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-23T01:56:25.317Z","etag":null,"topics":["apollographql","authentication","firebase","gcp","graphql","nextjs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/timReynolds.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}},"created_at":"2019-03-01T12:55:25.000Z","updated_at":"2021-10-18T13:32:14.000Z","dependencies_parsed_at":"2023-02-08T10:17:07.916Z","dependency_job_id":null,"html_url":"https://github.com/timReynolds/firebase-authentication-for-nextjs-with-apollo","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/timReynolds%2Ffirebase-authentication-for-nextjs-with-apollo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timReynolds%2Ffirebase-authentication-for-nextjs-with-apollo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timReynolds%2Ffirebase-authentication-for-nextjs-with-apollo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timReynolds%2Ffirebase-authentication-for-nextjs-with-apollo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timReynolds","download_url":"https://codeload.github.com/timReynolds/firebase-authentication-for-nextjs-with-apollo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250354304,"owners_count":21416751,"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":["apollographql","authentication","firebase","gcp","graphql","nextjs"],"created_at":"2024-10-19T16:10:39.130Z","updated_at":"2025-04-23T01:56:30.671Z","avatar_url":"https://github.com/timReynolds.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Firebase Authentication example for Next.JS (SSR React) with Apollo\n\nUnlike traditional frameworks that provide a server-side templating engine to create HTML which can then be shipped to the client (browser), SPA which are server-side rendered require the ability to authenticate the user against the API on both the client and the server.\n\nNext.JS already provides many examples of various authentication setups, however, if you're trying to follow along using an external authentication provider, like firebase, along with Apollo server you'd have to follow serval examples without extensive explanation.\n\nThis repository builds on those to provide a more comprehensive example referencing the relevant documentation to help you understand what's required to create an application using these technologies which includes authentication.\n\n## Running the example\n\nTo run the example, you'll need both client and admin credentials retrieved from your [firebase accounts](https://firebase.google.com) console.\n\nClient credentials are required to run the [firebase web ui](https://github.com/firebase/firebaseui-web) and can be retrieved using the Web setup button in the Authentication screen in the Firebase console. These should be placed in `creds/firebase-client.json`.\n\n```json\n{\n  \"apiKey\": \"\",\n  \"authDomain\": \"\"\n}\n```\n\nAdmin credentials are required to initialise the firebase admin SDK used on the server to create cookies and verify them. These are retrieved using the Service accounts tab in the Settings screen of the Firebase console. These should be placed in `creds/firebase-admin.json`.\n\n```json\n{\n  \"type\": \"\",\n  \"project_id\": \"\",\n  \"private_key_id\": \"\",\n  \"private_key\": \"\",\n  \"client_email\": \"\",\n  \"client_id\": \"\",\n  \"auth_uri\": \"\",\n  \"token_uri\": \"\",\n  \"auth_provider_x509_cert_url\": \"\",\n  \"client_x509_cert_url\": \"\"\n}\n```\n\nBoth the server and the client can then run using `npm run dev` in both the server and client folder which will run the UI on [http://localhost:3000](http://localhost:3000)\n\n## Explanation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimreynolds%2Ffirebase-authentication-for-nextjs-with-apollo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimreynolds%2Ffirebase-authentication-for-nextjs-with-apollo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimreynolds%2Ffirebase-authentication-for-nextjs-with-apollo/lists"}