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.
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:
consthttp=require('node:http');// Create an HTTP serverconstserver=http.createServer((req, res) => {const { job,token } =JSON.parse(req.body);// Do something with the jobawaitdoSomething(job);// Update progress to 100constupdateProgress=awaitfetch(`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'));});