# Authentication

Authentication is handled by the [Gravity Server authentication process](/gravity-server/authentication.md).

When a user opens your app for the first time, they will be asked to sign in (or create a free account). If the user is successfully authenticated on the server, the sign-in form executes a callback to the `signin` method contained in the [AppContext](/gravity-native/app-context.md) and passes the user object.

The sign-in process then executes three tasks:

1. Stores the user object (`token`, `permission`, `name`) in local storage&#x20;
2. Sets the Bearer token for all API calls
3. Prompts the user to allow push notifications (if they haven't already)
4. Redirects the user to the dashboard

The next time the app is loaded, the app will check the auth status of the user and direct them to `/signin` if there isn't an active token.

## User Permissions

User permissions for the client app are stored in `/app/config.json` under `permissions`.


---

# 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://docs.usegravity.app/gravity-native/authentication.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.
