I want to log in to gmail using its REST API without using any client libraries. So, there should be only HTTP/HTTPS requests and maybe a handshake + key calculation (basically what a browser does).
I tried searching for the gmail API as well as logging through the browser and observing the network tab. Neither worked fully.
There are a few things you may be misunderstanding. First the term Login implies that you want to use your login and pass word for the gmail account. This was called client login and was disabled by Google around may 2015.
The term you may need be missunderstanding is the term login or sign-in. One does not login to an api to use it. One requests consent of the user to access their data.
In order to access gmail data using the rest api you need to use Oauth2 and no you do not need to use the client libraries the calls are all https and can be done without the libraries.
Assuming this is a web app try and check web-server#httprest with desktop app the only real difference is the loop back address is http://127.0.0.1
Once you have an access token the requests you need to make for gmail can all be found in the documentation you just send the access token as a bearer token authorization header.
I have done it before for a client. Its a nice learning exercise not depending upon a library and building it yourself from the ground up.