@@ -27,17 +27,20 @@ Ionic...) nor Chrome extensions.
27
27
4 . [ Customization] ( #customizing-firebaseui-for-authentication )
28
28
5 . [ Advanced] ( #advanced )
29
29
6 . [ Known issues] ( #known-issues )
30
+ 7 . [ Release Notes] ( #release-notes )
30
31
31
32
## Installation
32
33
33
34
You just need to include the following script and CSS file in the ` <head> ` tag of your page,
34
35
below the initialization snippet from the Firebase Console:
35
36
36
37
``` html
37
- <script src =" https://www.gstatic.com/firebasejs/ui/live/0.4 /firebase-ui-auth.js" ></script >
38
- <link type =" text/css" rel =" stylesheet" href =" https://www.gstatic.com/firebasejs/ui/live/0.4 /firebase-ui-auth.css" />
38
+ <script src =" https://www.gstatic.com/firebasejs/ui/live/0.5 /firebase-ui-auth.js" ></script >
39
+ <link type =" text/css" rel =" stylesheet" href =" https://www.gstatic.com/firebasejs/ui/live/0.5 /firebase-ui-auth.css" />
39
40
```
40
41
42
+ You can then serve your app locally using ` firebase serve ` .
43
+
41
44
## Using FirebaseUI for Authentication
42
45
43
46
FirebaseUI includes the following flows:
@@ -70,11 +73,13 @@ instance should be passed to the constructor of `firebaseui.auth.AuthUI`. You ca
70
73
` start ` method with the CSS selector that determines where to create the widget, and a configuration
71
74
object.
72
75
73
- The following example shows how to set up a sign-in screen with all supported providers.
76
+ The following example shows how to set up a sign-in screen with all supported providers. Please
77
+ refer to the [ demo application in the examples folder] ( examples/demo/ ) for a more in-depth
78
+ example, showcasing a Single Page Application mode.
74
79
75
- > We recommend opening the widget in a popup window or redirecting to it, as a
76
- > [ known issue with single page applications ] ( # web-single-page-applications-are-not-fully-supported )
77
- > may lead to a rendering bug .
80
+ > Firebase and FirebaseUI do not work when executed directly from a file (i.e. opening the file in
81
+ > your browser, not through a web server). Always run ` firebase serve ` (or your preferred local
82
+ > server) to test your app locally .
78
83
79
84
``` html
80
85
<!DOCTYPE html>
@@ -86,8 +91,8 @@ The following example shows how to set up a sign-in screen with all supported pr
86
91
* TODO(DEVELOPER): Paste the initialization snippet from:
87
92
* Firebase Console > Overview > Add Firebase to your web app. *
88
93
***************************************************************************************** -->
89
- <script src =" https://www.gstatic.com/firebasejs/ui/live/0.4 /firebase-ui-auth.js" ></script >
90
- <link type =" text/css" rel =" stylesheet" href =" https://www.gstatic.com/firebasejs/ui/live/0.4 /firebase-ui-auth.css" />
94
+ <script src =" https://www.gstatic.com/firebasejs/ui/live/0.5 /firebase-ui-auth.js" ></script >
95
+ <link type =" text/css" rel =" stylesheet" href =" https://www.gstatic.com/firebasejs/ui/live/0.5 /firebase-ui-auth.css" />
91
96
<script type =" text/javascript" >
92
97
// FirebaseUI config.
93
98
var uiConfig = {
@@ -190,6 +195,7 @@ FirebaseUI supports the following configuration parameters.
190
195
| callbacks | No | ` [] ` | A list of developers [ callbacks] ( #available-callbacks ) after specific events. |
191
196
| queryParameterForSignInSuccessUrl| No | ` "signInSuccessUrl" ` | The redirect URL parameter name for the sign-in success URL. See [ Overwriting the sign-in success URL] ( #overwriting-the-sign-in-success-url ) . |
192
197
| queryParameterForWidgetMode | No | ` "mode" ` | The redirect URL parameter name for the “mode” of the Widget. See [ FirebaseUI widget modes] ( #firebaseui-widget-modes ) . |
198
+ |signInFlow |No |` "redirect" ` |The sign-in flow to use for IDP providers: ` redirect ` or ` popup ` .
193
199
| signInOptions | Yes | - | The list of [ providers] ( #available-providers ) enabled for signing into your app. The order you specify them will be the order they are displayed on the sign-in provider selection screen.|
194
200
| signInSuccessUrl | No | - | The URL where to redirect the user after a successful sign-in. ** Required** when the ` signInSuccess ` callback is not used or when it returns ` true ` . |
195
201
| tosUrl | Yes | - | The URL of the Terms of Service page. |
@@ -204,6 +210,43 @@ FirebaseUI supports the following configuration parameters.
204
210
| Github | ` firebase.auth.GithubAuthProvider.PROVIDER_ID ` |
205
211
| Email and password| ` firebase.auth.EmailAuthProvider.PROVIDER_ID ` |
206
212
213
+ ### Custom scopes
214
+
215
+ To specify custom scopes per provider, you can pass an object instead of just the provider value:
216
+
217
+ ``` javascript
218
+ ui .start (' #firebaseui-auth-container' , {
219
+ signInOptions = [
220
+ {
221
+ provider: firebase .auth .GoogleAuthProvider .PROVIDER_ID ,
222
+ scopes: [
223
+ ' https://www.googleapis.com/auth/plus.login'
224
+ ]
225
+ },
226
+ {
227
+ provider: firebase .auth .FacebookAuthProvider .PROVIDER_ID ,
228
+ scopes: [
229
+ ' public_profile' ,
230
+ ' email' ,
231
+ ' user_likes' ,
232
+ ' user_friends'
233
+ ]
234
+ },
235
+ firebase .auth .TwitterAuthProvider .PROVIDER_ID , // Twitter does not support scopes.
236
+ firebase .auth .EmailAuthProvider .PROVIDER_ID // Other providers don't need to be given as object.
237
+ ]
238
+ });
239
+ ```
240
+
241
+ ### Sign In Flows
242
+
243
+ Two sign in flows are available:
244
+
245
+ - ` redirect ` , the default, will perform a full page redirect to the sign-in page of the provider
246
+ (Google, Facebook...). This is recommended for mobile apps.
247
+ - The ` popup ` flow will open a popup to the sign-in page of the provider. If the popup is blocked by
248
+ the browser, it will fall back to a full page redirect.
249
+
207
250
### Available callbacks
208
251
209
252
Currently only one callback is supported. Some will be added soon to monitor UI changes.
@@ -242,15 +285,17 @@ If the callback returns `false` or nothing, the page is not automatically redire
242
285
* TODO(DEVELOPER): Paste the initialization snippet from:
243
286
* Firebase Console > Overview > Add Firebase to your web app. *
244
287
***************************************************************************************** -->
245
- <script src =" https://www.gstatic.com/firebasejs/ui/live/0.4 /firebase-ui-auth.js" ></script >
246
- <link type =" text/css" rel =" stylesheet" href =" https://www.gstatic.com/firebasejs/ui/live/0.4 /firebase-ui-auth.css" />
288
+ <script src =" https://www.gstatic.com/firebasejs/ui/live/0.5 /firebase-ui-auth.js" ></script >
289
+ <link type =" text/css" rel =" stylesheet" href =" https://www.gstatic.com/firebasejs/ui/live/0.5 /firebase-ui-auth.css" />
247
290
<script type =" text/javascript" >
248
291
// FirebaseUI config.
249
292
var uiConfig = {
250
293
// Query parameter name for mode.
251
294
' queryParameterForWidgetMode' : ' mode' ,
252
295
// Query parameter name for sign in success url.
253
296
' queryParameterForSignInSuccessUrl' : ' signInSuccessUrl' ,
297
+ // Will use popup for IDP Providers sign-in flow instead of the default, redirect.
298
+ ' signInFlow' : ' popup' ,
254
299
' signInSuccessUrl' : ' <url-to-redirect-to-on-success>' ,
255
300
' signInOptions' : [
256
301
// Leave the lines as is for the providers you want to offer your users.
@@ -335,9 +380,33 @@ When a user has enabled the private browsing mode in Safari, the web storage is
335
380
currently results in an error being thrown upon Firebase Auth initialization. Therefore, when
336
381
following the snippets above, FirebaseUI will never get initialized and no UI will be displayed.
337
382
338
- ### Web Single Page Applications are not fully supported
383
+ ### Tips for Single Page apps ( ` UI Widget is already rendered on the page ` warning)
339
384
340
385
When re-rendering the FirebaseUI Auth widget (for instance after signing in a user, signing her out
341
- and trying to sign her in again), it will fail with an `Uncaught Error: UI Widget is already
342
- initialized on the page. Only one widget instance can be initialized per page.` error. We recommend
343
- using the widget in a popup window or redirecting to it while we work on a fix for this issue.
386
+ and trying to sign her in again), it will sometimes log a warning: `UI Widget is already rendered on
387
+ the page and is pending some user interaction. Only one widget instance can be rendered per page.
388
+ The previous instance has been automatically reset.`. This happens when the UI widget was in a
389
+ pending state, i.e. the user was in the middle of performing a sign-in flow. You should generally
390
+ avoid re-rendering the widget in the middle of an action, but if you do, to avoid the warning, you
391
+ should use the ` reset() ` method before re-rendering the widget.
392
+
393
+ ## Release Notes
394
+
395
+ ### 0.5.0
396
+
397
+ See the milestone [ 0.5.0] ( https://github.com/firebase/firebaseui-web/milestone/1 ) for the issues
398
+ covered in this release. Below is a summary of the most important ones:
399
+
400
+ - FirebaseUI now supports ** Single Page Application** : a ` reset ` method was added to allow to
401
+ dispose of the widget. When the user leaves a page where the FirebaseUI widget was rendered (for
402
+ instance in the ` componentWillUnmount ` method of a React component), call the ` reset ` method of the
403
+ ` firebaseui.auth.AuthUI ` instance you created. Also, call the ` reset ` method before rendering
404
+ again the widget if one has already been rendered on the page. Please refer to the
405
+ [ demo app] ( examples/demo/ ) for guidance on how to use FirebaseUI in a Single Page
406
+ Application context.
407
+ - ** Custom scopes** can now be added for each provider. See [ Custom Scopes] ( custom-scopes ) .
408
+ - Several issues, different but related to the ` displayName ` not being present after sign up with
409
+ email and password, have been fixed.
410
+ - A new config parameter has been added: ` signInFlow ` . It allows to specify whether the Identity
411
+ Providers sign in flows should be done through ` redirect ` (the default) or ` popup ` . See
412
+ [ Sign In Flows] ( sign-in-flows ) .
0 commit comments