Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into css-optimization
- Loading branch information
Showing
21 changed files
with
180 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,3 @@ | ||
# Example: Firebase authentication with a serverless API | ||
# With Firebase Authentication | ||
|
||
This example includes Firebase authentication and serverless [API routes](https://nextjs.org/docs/api-routes/introduction). | ||
|
||
## How to use | ||
|
||
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) or [npx](https://github.com/zkat/npx#readme) to bootstrap the example: | ||
|
||
```bash | ||
npx create-next-app --example with-firebase-authentication with-firebase-authentication-app | ||
# or | ||
yarn create next-app --example with-firebase-authentication with-firebase-authentication-app | ||
``` | ||
|
||
## Configuration | ||
|
||
Set up Firebase: | ||
|
||
- Create a project at the [Firebase console](https://console.firebase.google.com/). | ||
- Copy the contents of `.env.local.example` into a new file called `.env.local` | ||
- Get your account credentials from the Firebase console at _Project settings > Service accounts_, where you can click on _Generate new private key_ and download the credentials as a json file. It will contain keys such as `project_id`, `client_email` and `private_key`. Set them as environment variables in the `.env.local` file at the root of this project. | ||
- Get your authentication credentials from the Firebase console under _Project settings > General> Your apps_ Add a new web app if you don't already have one. Under _Firebase SDK snippet_ choose _Config_ to get the configuration as JSON. It will include keys like `apiKey` and `authDomain`. Set the appropriate environment variables in the `.env.local` file at the root of this project. | ||
- Go to **Develop**, click on **Realtime Database** and create a database if you don't already have one. Under _data_ get `databaseUrl`(e.g. `https://[dbname].firebaseio.com/`). Set the appropriate environment variables in the `.env.local` file at the root of this project. | ||
- Go to **Develop**, click on **Authentication** and in the **Sign-in method** tab enable authentication for the app. | ||
|
||
Install it and run: | ||
|
||
```bash | ||
npm install | ||
npm run dev | ||
# or | ||
yarn | ||
yarn dev | ||
``` | ||
|
||
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)). | ||
|
||
After deploying, copy the deployment URL and navigate to your Firebase project's Authentication tab. Scroll down in the page to "Authorized domains" and add that URL to the list. | ||
Check out the [next-firebase-auth](https://github.com/gladly-team/next-firebase-auth) package and their [official example](https://github.com/gladly-team/next-firebase-auth/tree/main/example) for a powerful implementation of Firebase authentication. |
42 changes: 0 additions & 42 deletions
42
examples/with-firebase-authentication/components/FirebaseAuth.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
examples/with-firebase-authentication/pages/api/getFood.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
examples/with-firebase-authentication/utils/auth/firebaseAdmin.js
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
examples/with-firebase-authentication/utils/auth/initFirebase.js
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
examples/with-firebase-authentication/utils/auth/mapUserData.js
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
examples/with-firebase-authentication/utils/auth/useUser.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.