# mhlogin(1) - man - phpMan

[MHLOGIN(1mh)](https://www.chedong.com/phpMan.php/man/MHLOGIN/1mh/markdown)                                                                            [MHLOGIN(1mh)](https://www.chedong.com/phpMan.php/man/MHLOGIN/1mh/markdown)



## NAME
       mhlogin - nmh login to external (OAuth) services

## SYNOPSIS
       **mhlogin** [**-help**] [**-version**] [**-user** _username_] [**-saslmech** _mechanism_] [**-authservice** _service_]
            [**-browser** _command_] [**-snoop**]

## DESCRIPTION
       **mhlogin** currently only supports OAuth  for  Gmail.   Run  **mhlogin**  **-user**  _username_  **-saslmech**
       **xoauth2**  **-authservice**  _gmail_  and load the printed URL in your browser.  Login to a Gmail ac‐
       count, grant authorization, and copy and paste the code into the **mhlogin** prompt.  Be sure  to
       use  the  same  account with the **-user** switch to **send**.  See the EXAMPLES section below for an
       example.

       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 can include any browser argu‐
       ments in the **-browser** argument string, e.g., 'google-chrome --new-window'.

       The **-snoop** switch can be used to view the HTTP transaction.

       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.  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 win‐
       dow, then copy and paste the authorization code in response to the **mhlogin** prompt.

## PROFILE COMPONENTS
       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
       [_send_(1)](https://www.chedong.com/phpMan.php/man/send/1/markdown)

## DEFAULTS
       `**-saslmech**' xoauth2



nmh-1.7.1                                    2016-10-10                                 [MHLOGIN(1mh)](https://www.chedong.com/phpMan.php/man/MHLOGIN/1mh/markdown)
