So, I'm programming a discord bot that basically conatcts an API I made for a whole bunch of different commands. Unfortunately, I am stuck on this one put request and I have the error pinpointed. The request doesn't seem to be sending the auth key that I have set in the headers. I checked the APIs logs and the auth middleware rejects the request because no key is provided. I would appreciate any and all help.
- This is in an async function
- All other requests have worked, in fact I copied and pasted this header from a previous working one
- This request requires no body
- In case this is somewhat relevant: This is in a
collector.on('collect', async () => {HERE})
.
let updatedUser = await axios.put(
`https://API-URL-GOES-HERE/api/users/${username}/loaChange`,
{
headers: {
auth:
'AUTH-KEY-GOES-HERE'
}
}
);
RECIEVED HEADERS FROM FAILURE:
{
host: 'API-URL-HERE.herokuapp.com',
connection: 'close',
accept: 'application/json, text/plain, */*',
'content-type': 'application/json;charset=utf-8',
'user-agent': 'axios/0.19.0',
'x-request-id': 'REQID',
'x-forwarded-for': 'IPADRESS',
'x-forwarded-proto': 'https',
'x-forwarded-port': '443',
via: '1.1 vegur',
'connect-time': '2',
'x-request-start': '1577766826940',
'total-route-time': '5',
'content-length': '194'
}
PREVIOUS SUCCESFUL REQUEST:
let initialUser = await axios.get(
`https://API-URL-GOES-HERE/api/users/${username}`,
{
headers: {
auth:
'AUTH-KEY-GOES-HERE'
}
}
);
Recieved Headers from Success:
{
host: 'API-URL-HERE.herokuapp.com',
connection: 'close',
accept: 'application/json, text/plain, */*',
auth: 'AUTH-KEY-HERE',
'user-agent': 'axios/0.19.0',
'x-request-id': 'REQID',
'x-forwarded-for': 'IPADDRESS',
'x-forwarded-proto': 'https',
'x-forwarded-port': '443',
via: '1.1 vegur',
'connect-time': '0',
'x-request-start': '1577766773203',
'total-route-time': '0'
}
NOTE: THIS IS NOT USING THE FORMAT OF A REGULAR AUTHENTICATION REQUEST, JUST THINK OF IT AS A HEADER OBJECT THAT ISN'T BEING PASSED THROUGH