Allow to use customClaims in eq_expr
Im developing a multi tenant system using firebase dataconnect and it would be very usefull use a query like this:
query getServices @auth(level: USER) {
services(where: {
tenantId: {eq_expr: "auth.token.tenantId"}
})
{
id
name
}
}
unfurtunately when i run this query i received the message:
query, getServices, services (where.tenantId.eqexpr: StringExpr): unsupported expression "auth.token.tenantId" (currently only "auth.uid" and "uuidV4()" are supported)
We've added more robust expression evaluation which should include being able to access custom claims in the auth token. Give it a try!
-
Fred Zhang commented
This should be possible now!
We recently added real CEL support to all `_expr` arguments!Give it a shot and let me know your feedbacks!
-
Victor Sanches Pergher commented
is possible already access custom claims by @auth like this
@auth(expr: "auth.token.plan == 'pro'")
i think that is not a huge task implement something like this in 'where'