# Custom claims

> What I'd recommend is to separate the auth from the access by using [Custom Claims](https://firebase.google.com/docs/auth/admin/custom-claims). Allow any one to create a user, but [attach a Cloud Function](https://firebase.google.com/docs/auth/extend-with-functions#trigger_a_function_on_user_creation) to the user create event. If the user matches one on the white list, set a [custom user claim](https://firebase.google.com/docs/auth/admin/custom-claims) (this just launched recently!)
>
> Finally, in your rules, check for that use property before giving access to the data:

```javascript
{
  "rules": {
    "adminContent": {
      ".read": "auth.token.admin === true",
      ".write": "auth.token.admin === true",
    }
  }
}
```

from [Firebase Authentication with whitelisted email addresses ](https://stackoverflow.com/questions/46552886/firebase-authentication-with-whitelisted-email-addresses)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://textav.gitbook.io/firebase-react-notes/auth/database-auth/whitelisting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
