Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using NGROK_SUBDOMAIN for /slack/add #2

Merged

Conversation

alexagranov
Copy link
Contributor

@alexagranov alexagranov commented May 15, 2018

Related to Issue #1

@freeall I'm not actually sure if this addresses the Slack login properly or whether it should be APP_HOST instead. This is correct.

Unfortunately after I Authorize on Slack, I'm getting

Debug: internal, implementation, error 
    Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
    at Sign.sign (crypto.js:285:26)
    at Object.sign (/Users/agranov/work/walkiebot/node_modules/jwa/index.js:76:45)
    at jwsSign (/Users/agranov/work/walkiebot/node_modules/jws/lib/sign-stream.js:32:24)
    at SignStream.sign (/Users/agranov/work/walkiebot/node_modules/jws/lib/sign-stream.js:58:21)
    at SignStream.<anonymous> (/Users/agranov/work/walkiebot/node_modules/jws/lib/sign-stream.js:46:12)
    at Object.onceWrapper (events.js:293:19)
    at emitNone (events.js:86:13)
    at DataStream.emit (events.js:188:7)
    at DataStream.<anonymous> (/Users/agranov/work/walkiebot/node_modules/jws/lib/data-stream.js:32:12)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)

no matter how I store the JWT tokens in local.json

How are you expecting the JWT file contents as JSON there?

@alexagranov
Copy link
Contributor Author

So to answer the question about storing the JWT RSA keys in local.json, they need to be stored like so:

{
  "private": "-----BEGIN RSA PRIVATE KEY-----\nMIICagIBAAKBhADANhcuzGaa+qW/bCqEiPw5GzC+EKHFUgUonEejR2MkT938cmYP\ntKOYtvwhP4GfvnOMds63+Rx0SqGNa87z2V0RvYU7DFtB8cmqxgqIlpzv+J5qh+32\n7UpIwUSQYyOld+XKQcRHQFq7dwsb4bDcGErhbrD7olZzoAVkEK1CO0nIY9JlGQID\nAQABAoGEALws+HtPj3BQzS5f1ixU9CFwVkLtg4LrrrM4dQYMYKpvKpP456Seo79h\n/esLAnuC+BrfQbhpQQs0+X67uiuPdQdmGa8iPUhtpDSX5II3+9vjbJmpoehD5lAi\n0BD9pbgkpmPc9YnE6hUFoKWNU5CnFVh/5Eefn9Y1VZErEMIXaAjf0E7RAkIO5Dgx\n4n1X0q9XDp+WR+sO5YFZNE5H13KSDLjT5QFy20FPoCx20AY0yvweitNFBIi+1b8T\ne9DhZf8q55UKdf++860CQgzoT6Mn5RpOr5mb6uVttepHam+EsZWh1z++ayrjrj0N\nFKnJvqMqtfTk9Nc2VK76p4gi+bcbxylcZosnw8bMxpFEnQJCCrjRqUFNRHWi38jc\nqOTBXylqN6NMlbePe48DaTXjFCK/5KgMO8POJCbe3tLQCUqZduYJvOqSXCgHUIoL\nqsuJR6DFAkIDnwEIkt6xXLXi8F0b9IV+rn5rvtxbUEYk+fTy2WE+e3b6k0DKYece\nR0VxQyrK1EM/7CAGgOKE9glGrOc91KE4i/kCQgkmK6aMv60S5JqeAanzn9eNbdmA\nQrh75sHVwK8rSW/IbgE/uKpK0RCkYD5Fd+L+FUqsDWlrof2CJFxZwBzKNbRliw==\n-----END RSA PRIVATE KEY-----\n",
  "public": "-----BEGIN RSA PUBLIC KEY-----\nMIGMAoGEAMA2Fy7MZpr6pb9sKoSI/DkbML4QocVSBSicR6NHYyRP3fxyZg+0o5i2\n/CE/gZ++c4x2zrf5HHRKoY1rzvPZXRG9hTsMW0HxyarGCoiWnO/4nmqH7fbtSkjB\nRJBjI6V35cpBxEdAWrt3CxvhsNwYSuFusPuiVnOgBWQQrUI7Schj0mUZAgMBAAE=\n-----END RSA PUBLIC KEY-----\n"
}

As talked about here: https://github.com/substack/rsa-json

This is because we can't rely on having newline endings present in local.json (which are attempted to be replaced in code like https://github.com/FoundersAS/walkiebot/blob/master/server/handlers/slack.js#L9) or else server startup bombs trying to parse that file.

@dinoshauer
Copy link
Contributor

Hi @alexagranov - I've been away for a bit, but now I am back.

  • There's no need for yarn start-dev as yarn dev or yarn start dev already takes care of starting the api and the devserver, including booting up a docker container with mongo and starting the ngrok proxy
  • Thank you for the JWT part, I will add that to the readme
  • Thanks for catching the hardcoded url :)

package.json Outdated
@@ -20,6 +20,7 @@
"test-redux-watch": "npm run test-redux -- --watch",
"test": "npm run test-styles && npm run test-redux",
"postinstall": "npm run build-prod",
"start-dev": "node ./devserver",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary as yarn dev will run everything :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dinoshauer - thanks for getting back! Hope you had some good time off :-)

And yes, sorry, forgot to update this bit - discovered I had a local Dynamodb process squatting on port 8000 which was throwing me. Will update...

@alexagranov
Copy link
Contributor Author

@dinoshauer Updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants