> For the complete documentation index, see [llms.txt](https://docs.bullmq.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bullmq.net/http-api/authentication.md).

# Authentication

The Authentication scheme in BullMQ Proxy is currently pretty simple. You add a list of valid comma separated tokens as an env variable (`AUTH_TOKENS`), and then for every request made to the proxy send one of those valid tokens as a BEARER token.

```powershell
curl --location 'http://localhost:8080/queues/my-test-queue/jobs' \
--header 'Authorization: Bearer 1234'
```

Sometimes, an endpoint that is processing a job will need to communicate with the proxy, for example for updating a job's progress status or adding logs to the job. This requires a different token, which is actually provided in the body of the call. For example, if the endpoint was implemented in NodeJS it would look something along these lines:

```javascript
const http = require('node:http');

// Create an HTTP server
const server = http.createServer((req, res) => {
  const { job, token } = JSON.parse(req.body);
  
  // Do something with the job
  await doSomething(job);
  
  // Update progress to 100
  const updateProgress = await fetch(`http://localhost:8080/queues/my-test-queue/jobs/${job.id}/progress`, {
    method: 'POST',
    body: JSON.stringify(100),
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${token}`
    }
  });

  res.writeHead(200, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify('job-result'));
});

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.bullmq.net/http-api/authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
