# Get a token

`POST /auth/token`

Yeah, this is the boring security stuff. Just get your super secret token and move on.

Base URL: https://galaxy.scalar.com, https://void.scalar.com/

## Request body (application/json)

Also accepts: application/xml.

Body for credentials to authenticate a user

- `email` (string, required)
- `password` (string, required)

Example:

```json
{
  "email": "marc@scalar.com",
  "password": "i-love-scalar"
}
```

## Responses

### 201: Token Created

Returns `Token`.

- `token` (string)

```json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
```

### 400: Bad Request

Returns `BadRequestError`.

- `type` (string)
- `title` (string)
- `status` (integer)
- `detail` (string)

```json
{
  "type": "https://example.com/errors/bad-request",
  "title": "Bad Request",
  "status": 400,
  "detail": "The request was invalid."
}
```

### 401: Unauthorized

Returns `UnauthorizedError`.

- `type` (string)
- `title` (string)
- `status` (integer)
- `detail` (string)

```json
{
  "type": "https://example.com/errors/not-found",
  "title": "Unauthorized",
  "status": 401,
  "detail": "You are not authorized to access this resource."
}
```

### 403: Forbidden

Returns `ForbiddenError`.

- `type` (string)
- `title` (string)
- `status` (integer)
- `detail` (string)

```json
{
  "type": "https://example.com/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "You are not authorized to access this resource."
}
```

### 429: Too Many Requests

Returns `TooManyRequestsError`.

- `type` (string)
- `title` (string)
- `status` (integer)
- `detail` (string)

```json
{
  "type": "https://example.com/errors/too-many-requests",
  "title": "Too Many Requests",
  "status": 429,
  "detail": "Rate limit exceeded. Please try again later."
}
```

## Example request

```bash
curl -X POST 'https://galaxy.scalar.com/auth/token' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "marc@scalar.com",
  "password": "i-love-scalar"
}'
```
