# authenticate

The authenticate() method for the SurrealDB Mojo SDK authenticates the current connection with a token.

Authenticates the current connection with a token, and stores it on the client for subsequent requests.

```python title="Method Syntax"
client.authenticate(token, session)
```

## Arguments

<table>
    <thead>
        <tr>
            <th colspan="2" scope="col">Argument</th>
            <th colspan="2" scope="col">Description</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td colspan="2" scope="row" data-label="Argument"><code>token</code></td>
            <td colspan="2" scope="row" data-label="Description">The JWT to authenticate with.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Argument"><code>session</code></td>
            <td colspan="2" scope="row" data-label="Description">An optional session id.</td>
        </tr>
    </tbody>
</table>

## Example usage

```python
client.authenticate("eyJhbGciOi...")
```

## See also

- [Authentication](/docs/reference/mojo/concepts/authentication.md)
- [`invalidate()`](/docs/reference/mojo/methods/invalidate.md)
