MHLOGIN(1mh)
π MHLOGIN π
okay bestie, welcome to mhlogin from the nmh fam β it's the one that handles logging you into external (OAuth) services. yes, that kind of login. grab a snack, we're doing auth β¨
πΈ NAME πΈ
mhlogin β nmh login to external (OAuth) services π«Ά
β¨ SYNOPSIS β¨
okay so real talk first, no cap: this implementation is no longer supported, but it's still sitting here for information purposes. why? two reasons, bestie:
- Google now only supports POP except with a private client ID π
- it also no longer supports OOB requests to Google's OAuth 2.0 authorization endpoint π
here's the shape of the thing:
mhlogin [-help] [-version] [-user username] [-saslmech mechanism]
[-authservice service] [-browser command] [-snoop]
π DESCRIPTION π
so rn mhlogin only supports OAuth for Gmail. that's it, that's the whole roster.
run
mhlogin -user username -saslmech xoauth2 -authservice gmail
and then load the printed URL in your browser. login to a Gmail account, grant authorization, and copy-paste the code into the mhlogin prompt. π
important bestie: be sure to use the same account with the -user switch to send. the vibes must match. β¨
there's a whole example down in EXAMPLES if you want the visual, keep scrolling π
The -browser switch causes mhlogin to load the URL directly into a new browser session. the command argument must include the browser invocation name, and it can include any browser arguments in the -browser argument string, e.g., 'google-chrome --new-window'. iconic.
The -snoop switch can be used to view the HTTP transaction. peek behind the curtain, you nosy queen π
All parameters configuring the service may be overridden by profile components. and even though only Gmail is supported out of the box, the user can define new services entirely in the profile. main character energy fr fr.
Profile components are prefixed by oauth-service-, for example, oauth-gmail-credential-file which specifies where mhlogin should write credentials and where send should read them. π¦
π EXAMPLES π
π Gmail π
First, login to the Gmail account that you want to use, e.g, user@example.com, using a web browser. πΈ
Then, enter a mhlogin command such as:
mhlogin -user user@example.com -saslmech xoauth2 -authservice gmail -browser 'google-chrome --new-window'
The username should be a complete email address. π§
Respond to the prompt in the browser window, then copy and paste the authorization code in response to the mhlogin prompt. slay, you did it π
β¨
π PROFILE COMPONENTS π
here's the whole lineup, no skips, no shortcuts:
oauth-gmail-credential-file: oauth-gmail
oauth-gmail-client_id: nmh project client_id
oauth-gmail-client_secret: nmh project client_secret
oauth-gmail-auth_endpoint: https://accounts.google.com/o/oauth2/auth
oauth-gmail-redirect_uri: urn:ietf:wg:oauth:2.0:oob
oauth-gmail-token_endpoint: https://accounts.google.com/o/oauth2/token
oauth-gmail-scope: https://mail.google.com/
π¦ SEE ALSO π¦
β DEFAULTS β
-saslmechβxoauth2
and that's the whole page bestie, you ate that π
mhlogin ships with nmh-1.8, dated 2016-10-10. yes, it's giving vintage. still iconic tho πβ¨π
π¦ where this page comes from
- debian trixie: nmh 1.8-3
- ubuntu noble: nmh 1.8-1build4
- ubuntu questing: nmh 1.8-3
- ubuntu resolute: nmh 1.8-4
- ubuntu stonking: nmh 1.8-4build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms