I looked through the firebase documentation and found :
The custom claims object should not contain any OIDC reserved key names or Firebase reserved names. Custom claims payload must not exceed 1000 bytes.
Here custom claims are referred to as "custom claims object" but no where could I find an example of setting a value that is not a primitive data type (int,float,string etc) as custom claim ( both in documentation and other tutorials ). Now I am confused is that object referring to the whole set of custom claims or a single custom claim.
To put it simply is this valid :
admin.auth().setCustomUserClaims(uid, {endDate: new Date()});
Or a general case
admin.auth().setCustomUserClaims(uid, {
key1: {
sub_key1: value1,
sub_key2: value2
},
key2: {
sub_key1: vlaue1
}
});
If this is not valid is there any way to set a timestamp as custom claim so that I can use it in security rules to allow access based on it.