You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are using [workbox-sw](https://developers.google.com/web/tools/workbox/modules/workbox-sw) to import workbox, you can use the [unpkg CDN](https://unpkg.com/) to import the plugin.
50
-
It will then be available under the global variable `WorkboxPluginFirebaseAuth`.
51
+
It will then be available under the global variable `WorkboxFirebaseAuth`.
If your service worker is served from firebase hosting, associated with the firebase app you use to authorize users, you can omit configuration altogether.
78
-
Otherwise the [`firebase.config`](#firebaseconfig) parameter is **REQUIRED**.
76
+
## `initFirebase` options
79
77
80
-
### firebase
78
+
If your service worker is hosted firebase hosting, associated with the firebase app you use to authorize users, you don't have to specify any options (the helper will load the firebase SDK from [reserved URLs](https://firebase.google.com/docs/hosting/reserved-urls)).
79
+
Otherwise the [`config`](#config) parameter is **REQUIRED**.
81
80
82
-
This key is used to configure the firebase instance.
81
+
### config
83
82
84
-
#### firebase.config
85
-
86
-
**Required:** If your service worker is NOT served from firebase hosting or if you use a different app to authorize users.
83
+
**Required:** If your service worker is NOT hosted on firebase hosting or if you use a different app to authorize users.
87
84
**Type:**`object`
88
85
89
86
The [firebase config object](https://firebase.google.com/docs/web/setup?authuser=0#config-object) from the app that you use to authorize your users.
90
87
91
-
#### firebase.version
88
+
#### version
92
89
93
-
**Type:**`string`
90
+
**Type:**`string`
94
91
**Default:**`7.14.2`
95
92
96
93
This key can be used to specify the firebase version to use.
@@ -99,6 +96,8 @@ This key can be used to specify the firebase version to use.
99
96
> In the future this should use the version form the dependency used for development.
100
97
> Sadly I haven't figured out how to achieve this yet (PRs welcome :sweat_smile:)
101
98
99
+
## `Plugin` options
100
+
102
101
### awaitResponse
103
102
104
103
**Type:**`boolean`
@@ -114,7 +113,7 @@ This key can be used to specify additional constraints on top of the route match
114
113
115
114
#### constraints.types
116
115
117
-
**Type:**`string | string[]`
116
+
**Type:**`string | string[]`
118
117
**Default:**`['*']`
119
118
120
119
This can be used to authorize only requests that accept certain types of responses (e.g. `application/json`)
@@ -124,14 +123,21 @@ This can be used to authorize only requests that accept certain types of respons
124
123
125
124
#### constraints.https
126
125
127
-
**Type:**`boolean`
126
+
**Type:**`boolean`
128
127
**Default:**`false`
129
128
130
-
Only allow requests from secure origins (`https://` or `localhost`) to be authorized.
129
+
Only allow requests to secure origins (`https://` or `localhost`) to be authorized.
130
+
131
+
#### constraints.sameOrigin
132
+
133
+
**Type:**`boolean`
134
+
**Default:**`true`
135
+
136
+
Only allow requests to the same origin as the service worker to be authorized.
0 commit comments