I have a deployed server (https://github.com/nicolsc/slack-sigfox-last-message/blob/master/server.js) and I need to set a URL like the one below to integrate a slack command:
http://{user}:{password}@serverurl.com/{slack route}
My question is, which user name and password do I need? My Pc? The server's? Also, the server URL should be like localhost:400XX.com?
Sorry if the question is not too clear but this is brand new to me, so any kind of help is really appreciated.
EDIT:
I already build a config.local.js file to configure all .env
entries. When I run npm start
and browse the localhost I get somthing like this:
Browsed localhost
And when I type the Login/password, I get this response from the npm:
slackbot-sigfox-last-message:debug { host: 'localhost:34005', connection: 'keep-alive', 'cache-control': 'max-age=0', authorization: 'Basic NTdjOWI4MWM5ZTkzYTE2Y2QyODg1ZmJlOjZkYjYxNzMwNTE1NWIzZjE3OTRjMGM2ZDI5MjE3MmY1', 'upgrade-insecure-requests': '1', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36', accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp, /;q=0.8', 'accept-encoding': 'gzip, deflate, sdch', 'accept-language': 'es-ES,es;q=0.8,en;q=0.6' } +0ms
slackbot-sigfox-last-message:debug Invalid slack token +2ms
slackbot-sigfox-last-message:debug {} +0ms
slackbot-sigfox-last-message:sigfox Error +1ms
slackbot-sigfox-last-message:sigfox { message: 'Invalid Slack Token' } +0ms
So apparently, the token is what is not right and I've been told it's because of the URL not being set correctly, that's my point.
Look at the auth.js in the project. Login and passwords are retrieved from environment variables:
process.env.LOGIN
process.env.PASSWORD
There are multiple options to set up environment variables. You can edit package.json and update scripts.start with "start": "LOGIN=user PASSWORD=123 node server.js". Or in Linux you can do: export LOGIN=user and the check variable by: echo $LOGIN
See also here
As stated in documentaion url should be:http://localhost:34005
As you figured out config.local.js is required with content:
module.exports = {
"LOGIN" : "a",
"PASSWORD" : "b",
"SLACK_TOKEN" : 111,
"SLACK_ROUTE" : "aaa"
}
You can also try to disable authentication in server.js