Firstly, I'm afraid that page might not be up to date; there have been some changes to modernize the login API recently, and that page was last updated in 2013. The canonical documentation is https://www.mediawiki.org/wiki/API:Login (in English).
Secondly, login API is mostly intended for scripts running in the context of the wiki you want to log in to, not for scripts running on other pages or browser extensions. I'm not an expert on this, but I think you'll want to look into using OAuth: https://www.mediawiki.org/wiki/OAuth.