This is a personal note on how to log into Drupal programmatically.
The following article was helpful:
curl --location 'http://drupal.d8/user/login?_format=json' \
--header 'Content-Type: application/json' \
--data '{
"name": "admin",
"pass": "admin"
}'
By sending a request like the above, I was able to obtain a response like the following:
{"current_user":{"uid":"1","roles":["authenticated","administrator"],"name":"admin"},"csrf_token":"wBr9ldleaUhmP4CgVh7PiyyxgNn_ig8GgAan9-Ul3Lg","logout_token":"tEulBvihW1SUkrnbCERWmK2jr1JEN_mRAQIdNNhhIDc"}
I hope this serves as a useful reference.