How To Install node-basic-auth on Kali Linux

In this tutorial we learn how to install node-basic-auth on Kali Linux. node-basic-auth is Generic basic auth Authorization header field parser for whatever

Introduction

In this tutorial we learn how to install node-basic-auth on Kali Linux.

What is node-basic-auth

node-basic-auth is:

nodejs basic auth parser module. This package is used as a dependency for node web applications that require a simple authentication mechanism.

API

var auth = require(‘basic-auth’)

auth(req)

Get the basic auth credentials from the given request. The Authorization header is parsed and if the header is invalid, undefined is returned, otherwise an object with name and pass properties.

auth.parse(string)

Parse a basic auth authorization header string. This will return an object with name and pass properties, or undefined if the string is invalid.

Example

Pass a Node.js request object to the module export. If parsing fails undefined is returned, otherwise an object with .name and .pass.

var auth = require(‘basic-auth’) var user = auth(req) // => { name: ‘something’, pass: ‘whatever’ }

A header string from any other location can also be parsed with auth.parse, for example a Proxy-Authorization header:

var auth = require(‘basic-auth’) var user = auth.parse(req.getHeader(‘Proxy-Authorization’))

There are three methods to install node-basic-auth on Kali Linux. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install node-basic-auth Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install node-basic-auth using apt-get by running the following command:

sudo apt-get -y install node-basic-auth

Install node-basic-auth Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install node-basic-auth using apt by running the following command:

sudo apt -y install node-basic-auth

Install node-basic-auth Using aptitude

If you want to follow this method, you might need to install aptitude on Kali Linux first since aptitude is usually not installed by default on Kali Linux. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install node-basic-auth using aptitude by running the following command:

sudo aptitude -y install node-basic-auth

How To Uninstall node-basic-auth on Kali Linux

To uninstall only the node-basic-auth package we can use the following command:

sudo apt-get remove node-basic-auth

Uninstall node-basic-auth And Its Dependencies

To uninstall node-basic-auth and its dependencies that are no longer needed by Kali Linux, we can use the command below:

sudo apt-get -y autoremove node-basic-auth

Remove node-basic-auth Configurations and Data

To remove node-basic-auth configuration and data from Kali Linux we can use the following command:

sudo apt-get -y purge node-basic-auth

Remove node-basic-auth configuration, data, and all of its dependencies

We can use the following command to remove node-basic-auth configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge node-basic-auth

Dependencies

node-basic-auth have the following dependencies:

References

Summary

In this tutorial we learn how to install node-basic-auth package on Kali Linux using different package management tools: apt, apt-get and aptitude.