NodeBB / NodeBB/nodebb-plugin-write-api
Create User from Node.js Failure.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 136
- Forks
- 75
- Avg merge
- 1m
- Merged PRs (30d)
- 8
Description
nodebb version 1.13.2
nodebb-plugin-write-api version 5.7.3
node.js version 12.14.1
post data:
username=Panama.City&password=12345678&email=panama.city%40domain.com
http request option:
{ hostname: 'localhost',
port: 4567,
path: '/api/v2/users',
method: 'POST',
timeout: 5000,
headers:
{ Authorization: 'Bearer <token>' } }
var req = require('http').request(options, (res) => {
let data = '';
// A chunk of data has been recieved.
res.on('data', (chunk) => {
data += chunk;
});
// The whole response has been received. Print out the result.
res.on('end', () => {
console.log(data);
var rt = JSON.parse(data);
if (callback) callback({status: 'success'});
});
req.on('error', (e) => {
if (callback) callback({status: 'failure'});
});
});
req.write(postData);
req.end();
Error: "value" required in setHeader("accessToken", value)
at validateHeader (_http_outgoing.js:492:11)
at ClientRequest.setHeader (_http_outgoing.js:501:3)
at new ClientRequest (_http_client.js:173:14)
at Object.request (http.js:38:10)
Any idea what I did wrong there? Thank you for an excellent plugin to an excellent forum platform.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the POST request to the /api/v2/users entry point with the versions and request options shown. Inspect how the write API handles the Authorization header and accessToken during user creation, then compare that path with the reported setHeader error. Done means the request either creates the user successfully or returns a clear, documented API error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100