File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 8686 * https://my-project-id.firebaseio.com
8787 */
8888 'url ' => env ('FIREBASE_DATABASE_URL ' ),
89+
90+ /*
91+ * As a best practice, a service should have access to only the resources it needs.
92+ * To get more fine-grained control over the resources a Firebase app instance can access,
93+ * use a unique identifier in your Security Rules to represent your service.
94+ *
95+ * https://firebase.google.com/docs/database/admin/start#authenticate-with-limited-privileges
96+ */
97+ // 'auth_variable_override' => [
98+ // 'uid' => 'my-service-worker'
99+ // ],
89100 ],
90101
91102 'dynamic_links ' => [
Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ protected function configure(string $name): FirebaseProject
8080 $ factory = $ factory ->withDatabaseUri ($ databaseUrl );
8181 }
8282
83+ if ($ authVariableOverride = $ config ['database ' ]['auth_variable_override ' ] ?? null ) {
84+ $ factory = $ factory ->withDatabaseAuthVariableOverride ($ authVariableOverride );
85+ }
86+
8387 if ($ defaultStorageBucket = $ config ['storage ' ]['default_bucket ' ] ?? null ) {
8488 $ factory = $ factory ->withDefaultStorageBucket ($ defaultStorageBucket );
8589 }
Original file line number Diff line number Diff line change @@ -221,6 +221,7 @@ public function the_realtime_database_url_can_be_configured(): void
221221 {
222222 $ projectName = $ this ->app ->config ->get ('firebase.default ' );
223223 $ this ->app ->config ->set ('firebase.projects. ' .$ projectName .'.database.url ' , $ url = 'https://domain.tld ' );
224+ $ this ->app ->config ->set ('firebase.projects. ' .$ projectName .'.database.auth_variable_override ' , ['uid ' => 'some-uid ' ]);
224225
225226 $ database = $ this ->app ->make (Firebase \Database::class);
226227
You can’t perform that action at this time.
0 commit comments