HTTPS Node.js Call with BASIC Authentication to login to IBM Cloud

IBM Cloud Login using NodeJS script

Contents

Recipes are community-created content. They are neither monitored nor endorsed by IBM. If you find inappropriate content, please use Report Abuse to let us know. For more information on community content, please refer to our Terms of Use.

Overview

Skill Level: Any Skill Level

Step by step guide to login to IBM Cloud using NodeJS script

Ingredients

Node Js

IBM Cloud

Step-by-step

How to Install Node Module

Below commond is used to install node module. It will start downloading the respected files on your machine. Open the command line, navigate to the folder C:nodeexamples and execute the below command.

npm install request;

npm install fs;

npm install q;

¬†

Once the installtion completed , you will see a ‚Äúnode‚ÄĚ folder is created under C:nodeexamples directory. Open the node module folder , You will see the required files and folders are installed to execute the login script.

Create login.js

Let’s start to write login.js program. Open your favorite editor and create a file called ‚Äúlogin.js‚ÄĚ under any directory like C:nodeexamples. One thing you need to do here , Change the username and password values.

¬†

Save the file and execute it through node.js, Open the command line, navigate to the folder C:nodeexamples and execute the below command