I wanted to understand the flow of authenticating users login from the CLI so I wrote a simple shell script using bash. It turned out really great.
This script basically recieves the user's email address and password, validates the email address, makes the request using curl and writes the response of the request to a file response.txt
in the same folder (Default behaviour). You can read into the file to extract the authentication token for subsequent request.
git clone https://github.com/Vickysomtee/cli-authentication.git
cd cli-login
Replace the <resource-endpoint>
with your login endpoint
url='<resource-endpoint>'
Replace the ./response.txt
with a symlink to your desired folder. You can leave the default file for the purpose of testing the script.
echo $response > ./response.txt
bash login.sh