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
CustomAuth custom_auth(timeStatusCB, API_KEY, FIREBASE_CLIENT_EMAIL, FIREBASE_PROJECT_ID, PRIVATE_KEY, "Node1"/* UID */, ""/* claims can be set later */, 3600/* expire period in seconds (<3600) */);
88
+
CustomAuth custom_auth(timeStatusCB, API_KEY, FIREBASE_CLIENT_EMAIL, FIREBASE_PROJECT_ID, PRIVATE_KEY, "peter"/* UID */, ""/* claims can be set later */, 3600/* expire period in seconds (<3600) */);
89
89
90
90
FirebaseApp app;
91
91
@@ -140,29 +140,25 @@ void setup()
140
140
// Here is the final security rules we want to set in this example.
// We use $ variable in the rules e.g. #userId to capture the path segment. If we access database at /UserData/xyz, the xyz well be our $userId variable in the rules.
157
-
// When the $userId was used in the condition e.g. "$userId === auth.uid", the result will be false for this xyz UID case.
158
-
// This will allow us to access the database only at /UserData/Node1.
159
-
// Then the user with provided UID e.g. xyz can only access to database at /UserData/xyz because the UID obtains from auth.uid variable
160
-
// matches the path segment variable $userId.
161
-
//
162
-
// In our rules above at the path UsersData/$userId, other auth variables are also checked
163
-
// i.e. auth.token which the admin's, premium_account's and foo's values are checked for maching.
164
-
// If one of these condition is false, the access to UsersData/$userId will be denied.
165
-
// The auth.token.??? is variable that taken from the ID token's claims.
159
+
// We use $ variable in the rules e.g. $resource, $group, and $userId to capture the path segment that are used to compare with the auth variables
160
+
// that we set e.g. $userId will be compared with UID (auth.uid), $resource will be compared with resource claim (auth.token.resource),
161
+
// and $group will be compared with group claim (auth.token.group).
166
162
//
167
163
// For more information, visit https://firebase.google.com/docs/database/security/rules-conditions#using_variables_to_capture_path_segments
168
164
//
@@ -178,19 +174,21 @@ void setup()
178
174
// ".read": "some other conditions that allow access by date"
179
175
// ".write": "some other conditions that allow access by date"
0 commit comments