Conversation
|
A good chunk of experimentation happened over in #201. Here's what it looks like so far: |
|
💥 https://huboard-rails-pr-214.herokuapp.com/ will now round-trip auth through https://huboard-rails.herokuapp.com/. Code is all in one file for hackability, but would welcome guidance on how best to structure it relative to the existing app. And general feedback, of course. |
|
👏 |
Heroku sets APP_NAME and PARENT_APP_NAME environment variables. The latter needs to replace the former in the OAuth redirect hostname, and the former needs to be appended as a query parameter to use on return. Env: HEROKU_APP_NAME = hb-pr-123 HEROKU_PARENT_APP_NAME = hb Input: https://hb-pr-123.herokuapp.com/ Output: https://hb.herokuapp.com/?APP_NAME=hb-pr-123
3b52cfa to
a46cffd
Compare
|
For reference, when you auth from a PR build you should see the Warden Override in the logs (e.g. And then on the parent side (e.g. Looking again at the logs, I'm going to suppress the |
|
@discorick raised a good point offline - the |


Closes #183. As discussed, due to OAuth host constraints this isn't as trivial as it would be for a simple app.
Add
app.jsonreview app config, mostly generated by Heroku.I did manually add
HEROKU_PARENT_APP_NAME, which I wish they had included in the generated file. It took me a long time to figure out thatapp.jsononly matters when a review app is first created - this second commit didn't take effect until I deleted the existing review app. Much time wasted here.Override
Warden::GitHub::Config.normalized_uri()to do two things:hostwith the parent app name instead of the current app name.APP_NAMEquery string with the current app name, so we can redirect back to it.UpdateAdd middleware to check forLoginControllerAPP_NAMEso we can redirect to review apps from the parent app as necessary.