Skip to content

Commit c50e958

Browse files
author
Thomas Cesare-Herriau
committed
Updated README per Lauren feedbacks.
Change-Id: I185421d8aca7c0e20cb53b15414fb679d536df3e
1 parent 1cbd33f commit c50e958

File tree

1 file changed

+34
-54
lines changed

1 file changed

+34
-54
lines changed

README.md

Lines changed: 34 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ FirebaseUI Auth clients are also available for [iOS](https://github.com/firebase
2626

2727
## Installation
2828

29-
You just need to include the following code in the `<head>` tag of your page:
29+
You just need to include the following script and CSS file in the `<head>` tag of your page,
30+
below the initialization snippet from the Firebase Console:
3031

3132
```html
32-
<script src="https://www.gstatic.com/firebasejs/live/3.0/firebase-app.js"></script>
33-
<script src="https://www.gstatic.com/firebasejs/live/3.0/firebase-auth.js"></script>
3433
<script src="https://www.gstatic.com/firebasejs/ui/live/0.4/firebase-ui-auth.js"></script>
3534
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/live/0.4/firebase-ui-auth.css" />
3635
```
@@ -75,20 +74,18 @@ The following example shows how to set up a sign-in screen with all supported pr
7574
<head>
7675
<meta charset="UTF-8">
7776
<title>Sample FirebaseUI App</title>
78-
<script src="firebase-app.js"></script>
79-
<script src="firebase-auth.js"></script>
80-
<script src="firebase-ui-auth.js"></script>
77+
<!-- *******************************************************************************************
78+
* TODO(DEVELOPER): Paste the initialization snippet from:
79+
* Firebase Console > Overview > Add Firebase to your web app. *
80+
***************************************************************************************** -->
81+
<script src="https://www.gstatic.com/firebasejs/ui/live/0.4/firebase-ui-auth.js"></script>
82+
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/live/0.4/firebase-ui-auth.css" />
8183
<script type="text/javascript">
82-
// Firebase config.
83-
var config = {
84-
'authDomain': '<your-firebase-project-domain>.firebaseapp.com',
85-
'apiKey': '<your-API-key>',
86-
};
87-
8884
// FirebaseUI config.
8985
var uiConfig = {
9086
'signInSuccessUrl': '<url-to-redirect-to-on-success>',
9187
'signInOptions': [
88+
// Leave the lines as is for the providers you want to offer your users.
9289
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
9390
firebase.auth.FacebookAuthProvider.PROVIDER_ID,
9491
firebase.auth.TwitterAuthProvider.PROVIDER_ID,
@@ -100,13 +97,10 @@ The following example shows how to set up a sign-in screen with all supported pr
10097
};
10198
10299
// Initialize the FirebaseUI Widget using Firebase.
103-
var app = firebase.initializeApp(config);
104-
var auth = app.auth();
105-
var ui = new firebaseui.auth.AuthUI(auth);
100+
var ui = new firebaseui.auth.AuthUI(firebase.auth());
106101
// The start method will wait until the DOM is loaded.
107102
ui.start('#firebaseui-auth-container', uiConfig);
108103
</script>
109-
<link type="text/css" rel="stylesheet" href="firebase-ui-auth.css" />
110104
</head>
111105
<body>
112106
<!-- The surrounding HTML is left untouched by FirebaseUI.
@@ -125,21 +119,13 @@ Here is how you would track the Auth state across all your pages:
125119
<head>
126120
<meta charset="UTF-8">
127121
<title>Sample FirebaseUI App</title>
128-
<script src="firebase-app.js"></script>
129-
<script src="firebase-auth.js"></script>
122+
<!-- *******************************************************************************************
123+
* TODO(DEVELOPER): Paste the initialization snippet from:
124+
* Firebase Console > Overview > Add Firebase to your web app. *
125+
***************************************************************************************** -->
130126
<script type="text/javascript">
131-
// Firebase config.
132-
var config = {
133-
'authDomain': '<your-firebase-project-domain>.firebaseapp.com',
134-
'apiKey': '<your-API-key>',
135-
};
136-
137-
// Instantiates the Firebase Auth instance.
138-
var app = firebase.initializeApp(config);
139-
var auth = app.auth();
140-
141127
initApp = function() {
142-
auth.onAuthStateChanged(function(user) {
128+
firebase.auth().onAuthStateChanged(function(user) {
143129
if (user) {
144130
// User is signed in.
145131
var displayName = user.displayName;
@@ -149,9 +135,9 @@ Here is how you would track the Auth state across all your pages:
149135
var uid = user.uid;
150136
var providerData = user.providerData;
151137
user.getToken().then(function(accessToken) {
152-
document.getElementById('quickstart-sign-in-status').textContent = 'Signed in';
153-
document.getElementById('quickstart-sign-in').textContent = 'Sign out';
154-
document.getElementById('quickstart-account-details').textContent = JSON.stringify({
138+
document.getElementById('sign-in-status').textContent = 'Signed in';
139+
document.getElementById('sign-in').textContent = 'Sign out';
140+
document.getElementById('account-details').textContent = JSON.stringify({
155141
displayName: displayName,
156142
email: email,
157143
emailVerified: emailVerified,
@@ -163,25 +149,25 @@ Here is how you would track the Auth state across all your pages:
163149
});
164150
} else {
165151
// User is signed out.
166-
document.getElementById('quickstart-sign-in-status').textContent = 'Signed out';
167-
document.getElementById('quickstart-sign-in').textContent = 'Sign in';
168-
document.getElementById('quickstart-account-details').textContent = 'null';
152+
document.getElementById('sign-in-status').textContent = 'Signed out';
153+
document.getElementById('sign-in').textContent = 'Sign in';
154+
document.getElementById('account-details').textContent = 'null';
169155
}
170156
}, function(error) {
171157
console.log(error);
172158
});
173159
};
174160
175-
window.onload = function() {
161+
window.addEventListener('load', function() {
176162
initApp()
177-
};
163+
});
178164
</script>
179165
</head>
180166
<body>
181167
<h1>Welcome to My Awesome App</h1>
182-
<div id="quickstart-sign-in-status"></div>
183-
<div id="quickstart-sign-in"></div>
184-
<div id="quickstart-account-details"></div>
168+
<div id="sign-in-status"></div>
169+
<div id="sign-in"></div>
170+
<div id="account-details"></div>
185171
</body>
186172
</html>
187173

@@ -245,16 +231,13 @@ If the callback returns `false` or nothing, the page is not automatically redire
245231
<head>
246232
<meta charset="UTF-8">
247233
<title>Sample FirebaseUI App</title>
248-
<script src="firebase-app.js"></script>
249-
<script src="firebase-auth.js"></script>
250-
<script src="firebase-ui-auth.js"></script>
234+
<!-- *******************************************************************************************
235+
* TODO(DEVELOPER): Paste the initialization snippet from:
236+
* Firebase Console > Overview > Add Firebase to your web app. *
237+
***************************************************************************************** -->
238+
<script src="https://www.gstatic.com/firebasejs/ui/live/0.4/firebase-ui-auth.js"></script>
239+
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/live/0.4/firebase-ui-auth.css" />
251240
<script type="text/javascript">
252-
// Firebase config.
253-
var config = {
254-
'authDomain': '<your-firebase-project-domain>.firebaseapp.com',
255-
'apiKey': '<your-API-key>',
256-
};
257-
258241
// FirebaseUI config.
259242
var uiConfig = {
260243
// Query parameter name for mode.
@@ -263,6 +246,7 @@ If the callback returns `false` or nothing, the page is not automatically redire
263246
'queryParameterForSignInSuccessUrl': 'signInSuccessUrl',
264247
'signInSuccessUrl': '<url-to-redirect-to-on-success>',
265248
'signInOptions': [
249+
// Leave the lines as is for the providers you want to offer your users.
266250
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
267251
firebase.auth.FacebookAuthProvider.PROVIDER_ID,
268252
firebase.auth.TwitterAuthProvider.PROVIDER_ID,
@@ -280,14 +264,10 @@ If the callback returns `false` or nothing, the page is not automatically redire
280264
}
281265
};
282266
283-
// Initialize the FirebaseUI Widget using Firebase.
284-
var app = firebase.initializeApp(config);
285-
var auth = app.auth();
286-
var ui = new firebaseui.auth.AuthUI(auth);
267+
var ui = new firebaseui.auth.AuthUI(firebase.auth());
287268
// The start method will wait until the DOM is loaded.
288269
ui.start('#firebaseui-auth-container', uiConfig);
289270
</script>
290-
<link type="text/css" rel="stylesheet" href="firebase-ui-auth.css" />
291271
</head>
292272
<body>
293273
<!-- The surrounding HTML is left untouched by FirebaseUI.

0 commit comments

Comments
 (0)