IBM Cloud + Node-RED + Passport oAuth

Hi, I am trying to figure out how to configure Node-RED on IBM Cloud. I have a instance with toolchain and connected to Passport. I am using this document to enable my Node-RED application to authenticate using my Inversoft Passport server. I have followed the instructions precisely up to step 6. I have created the various resources on my Inversoft server and I am confident that the api key. application_id and service name are correct and in vcap_services I have added the environment variables.

At the moment when I visit the application I do not receive a login dialog box, I presume that this is because I need to complete step 8. However, I am uncertain how to implement these code snippets, can anyone confirm that I need to implement the code snippets and if so where?