8000 Switch to using implicit init in auth, database and storage quickstar… · sengbh/quickstart-js@e6b4da8 · GitHub
[go: up one dir, main page]

Skip to content

Commit e6b4da8

Browse files
Switch to using implicit init in auth, database and storage quickstarts (firebase#129)
1 parent 605223e commit e6b4da8

26 files changed

+119
-110
lines changed

auth/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ We also provide the [code for a Chrome Extension](chromeextension) showing how t
1616
Introduction
1717
------------
1818

19-
- [Read more about Firebase Auth](https://firebase.google.com/docs/auth/)
19+
[Read more about Firebase Auth](https://firebase.google.com/docs/auth/)
2020

2121
Getting Started
2222
---------------
2323

24-
- Set up your project on the [Firebase Console](https://console.firebase.google.com).
25-
- Enable the authentication method you want to use in the Auth section > SIGN IN METHOD tab - you don't need to enable custom auth.
26-
- In the [Google Developer Console](https://console.developers.google.com), access the project you created in the Firebase Console.
27-
- For Custom Auth, also create a new Service Account in your project [Developers Console](https://console.developers.google.com/apis/credentials/serviceaccountkey?project=_), and download the JSON representation.
28-
- For Facebook, Twitter and GitHub you will need to create an application as a developer on their developer platform, whitelist `https://<project_id>.firebaseapp.com/__/auth/handler` for auth redirects and enable and setup the app's credentials in the Firebase Console > Auth > SIGN IN METHOD.
29-
- Edit the `.html` for the authentication method you want to try and copy the initialization snippet from the Firebase Console **Overview > Add Firebase to your web app** into the `<head>` section of `.html`.
30-
- Run `firebase serve` using the Firebase CLI tool to launch a local server and open the sample `.html` in a web browser.
24+
1. Create a Firebase project on the [Firebase Console](https://console.firebase.google.com).
25+
1. Enable the authentication method you want to use by going to the **Authentication** section in the **SIGN-IN METHOD** tab - you don't need to enable custom auth.
26+
- For **Custom Auth**, generate a Service Account credentials in your [Firebase Console > Project Settings > Service Accounts](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk), and click on **GENERATE NEW PRIVATE KEYS**. You will need it in the [example token generator](exampletokengenerator/auth.html).
27+
- For **Facebook**, **Twitter** and **GitHub** you will need to create an application as a developer on their respective developer platform, whitelist `https://<project_id>.firebaseapp.com/__/auth/handler` for auth redirects and enable and setup the app's credentials in the **Firebase Console > Authentication > SIGN-IN METHOD**.
28+
1. You must have the [Firebase CLI](https://firebase.google.com/docs/cli/) installed. If you don't have it install it with `npm install -g firebase-tools` and then configure it with `firebase login`.
29+
1. On the command line run `firebase use --add` and select the Firebase project you have created.
30+
1. Run `firebase serve` using the Firebase CLI tool to launch a local server and open the sample `.html` in a web browser.
3131

3232
Support
3333
-------

auth/anon.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727

2828
<link rel="stylesheet" href="main.css">
2929

30-
<!-- Firebase -->
31-
<!-- ***********************************************************************************************************************
32-
* TODO(DEVELOPER): Paste the initialization snippet from: Firebase Console > Overview > Add Firebase to your web app. *
33-
*********************************************************************************************************************** -->
30+
<!-- Import and configure the Firebase SDK -->
31+
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
32+
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
33+
<script src="/__/firebase/3.9.0/firebase-app.js"></script>
34+
<script src="/__/firebase/3.9.0/firebase-auth.js"></script>
35+
<script src="/__/firebase/init.js"></script>
3436

3537
<script type="text/javascript">
3638

auth/chromextension/credentials.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<!-- ***************************************************************************************
2626
* TODO(DEVELOPER): Make sure you are importing the latest version of the Firebase JS. *
2727
*************************************************************************************** -->
28-
<script src="https://www.gstatic.com/firebasejs/3.3.0/firebase.js"></script>
28+
<script src="https://www.gstatic.com/firebasejs/3.9.0/firebase.js"></script>
2929
<script src="credentials.js"></script>
3030
</head>
3131
<body>

auth/chromextension/credentials.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// TODO(DEVELOPER): Change the values below using values from the initialization snippet: Firebase Console > Overview > Add Firebase to your web app.
22
// Initialize Firebase
33
var config = {
4-
apiKey: "<YOUR_API_KEY>",
5-
databaseURL: "<YOUR_DATABASE_URL>",
6-
storageBucket: "<YOUR_STORAGE_BUCKET_NAME>"
4+
apiKey: '<YOUR_API_KEY>',
5+
databaseURL: '<YOUR_DATABASE_URL>',
6+
storageBucket: '<YOUR_STORAGE_BUCKET_NAME>'
77
};
88
firebase.initializeApp(config);
99

auth/customauth.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727

2828
<link rel="stylesheet" href="main.css">
2929

30-
<!-- Firebase -->
31-
<!-- ***********************************************************************************************************************
32-
* TODO(DEVELOPER): Paste the initialization snippet from: Firebase Console > Overview > Add Firebase to your web app. *
33-
*********************************************************************************************************************** -->
30+
<!-- Import and configure the Firebase SDK -->
31+
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
32+
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
33+
<script src="/__/firebase/3.9.0/firebase-app.js"></script>
34+
<script src="/__/firebase/3.9.0/firebase-auth.js"></script>
35+
<script src="/__/firebase/init.js"></script>
3436

3537
<script type="text/javascript">
3638

auth/email.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727

2828
<link rel="stylesheet" href="main.css">
2929

30-
<!-- Firebase -->
31-
<!-- ***********************************************************************************************************************
32-
* TODO(DEVELOPER): Paste the initialization snippet from: Firebase Console > Overview > Add Firebase to your web app. *
33-
*********************************************************************************************************************** -->
30+
<!-- Import and configure the Firebase SDK -->
31+
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
32+
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
33+
<script src="/__/firebase/3.9.0/firebase-app.js"></script>
34+
<script src="/__/firebase/3.9.0/firebase-auth.js"></script>
35+
<script src="/__/firebase/init.js"></script>
3436

3537
<script type="text/javascript">
3638

auth/facebook-credentials.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ <h2 class="mdl-card__title-text">Facebook Authentication with OAuth Credentials<
6666
</main>
6767
</div>
6868

69-
70-
<!-- Firebase -->
71-
<!-- ***********************************************************************************************************************
72-
* TODO(DEVELOPER): Paste the initialization snippet from: Firebase Console > Overview > Add Firebase to your web app. *
73-
*********************************************************************************************************************** -->
69+
<!-- Import and configure the Firebase SDK -->
70+
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
71+
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
72+
<script src="/__/firebase/3.9.0/firebase-app.js"></script>
73+
<script src="/__/firebase/3.9.0/firebase-auth.js"></script>
74+
<script src="/__/firebase/init.js"></script>
7475

7576
<script type="text/javascript">
7677
/**

auth/facebook-popup.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727

2828
<link rel="stylesheet" href="main.css">
2929

30-
<!-- Firebase -->
31-
<!-- ***********************************************************************************************************************
32-
* TODO(DEVELOPER): Paste the initialization snippet from: Firebase Console > Overview > Add Firebase to your web app. *
33-
*********************************************************************************************************************** -->
30+
<!-- Import and configure the Firebase SDK -->
31+
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
32+
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
33+
<script src="/__/firebase/3.9.0/firebase-app.js"></script>
34+
<script src="/__/firebase/3.9.0/firebase-auth.js"></script>
35+
<script src="/__/firebase/init.js"></script>
3436

3537
<script type="text/javascript">
3638

auth/facebook-redirect.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727

2828
<link rel="stylesheet" href="main.css">
2929

30-
<!-- Firebase -->
31-
<!-- ***********************************************************************************************************************
32-
* TODO(DEVELOPER): Paste the initialization snippet from: Firebase Console > Overview > Add Firebase to your web app. *
33-
*********************************************************************************************************************** -->
30+
<!-- Import and configure the Firebase SDK -->
31+
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
32+
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
33+
<script src="/__/firebase/3.9.0/firebase-app.js"></script>
34+
<script src="/__/firebase/3.9.0/firebase-auth.js"></script>
35+
<script src="/__/firebase/init.js"></script C4C2 >
3436

3537
<script type="text/javascript">
3638

auth/github-popup.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727

2828
<link rel="stylesheet" href="main.css">
2929

30-
<!-- Firebase -->
31-
<!-- ***********************************************************************************************************************
32-
* TODO(DEVELOPER): Paste the initialization snippet from: Firebase Console > Overview > Add Firebase to your web app. *
33-
*********************************************************************************************************************** -->
30+
<!-- Import and configure the Firebase SDK -->
31+
<!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
32+
<!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
33+
<script src="/__/firebase/3.9.0/firebase-app.js"></script>
34+
<script src="/__/firebase/3.9.0/firebase-auth.js"></script>
35+
<script src="/__/firebase/init.js"></script>
3436

3537
<script type="text/javascript">
3638

0 commit comments

Comments
 (0)
0