Skip to content

Commit 9c5255e

Browse files
authored
Update mailing-lists.md
1 parent 7c7d365 commit 9c5255e

1 file changed

Lines changed: 3 additions & 34 deletions

File tree

docs/notes/sysadmin/linux/mailing-lists.md

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,8 @@ This will generate two strings, client_id and client_secret.
1818

1919
### Step 2: generate OAuth2 token
2020

21-
Use Google’s OAuth2 authentication script https://github.com/google/gmail-oauth2-tools/blob/master/python/oauth2.py to generate an OAuth2 refresh token.
21+
Run the following script:
2222

23-
`python oauth2.py --generate_oauth2_token --user={user} --client_id={client_id} --client_secret={client_secret}`
23+
<script src="https://gist.github.com/LandonTClipp/84b4855fbca0f1d088990a8f7a6e00de.js"></script>
2424

25-
`{user}` is the email address you use to login to Gmail.
26-
`{client_id}` and `{client_secret}` are the strings you got from Step 1.
27-
The script will ask you to visit a URL in your browser and follow some directions, and prompt you for a verification code. After visiting the URL and agreeing to various things, you will be provided a verification code (from https://oauth2.dance). Enter this verification code into the script prompt. The script will then print the Refresh Token (in addition two other things that are not needed).
28-
29-
### Step 3: configure account in aerc
30-
31-
Edit the accounts.conf file in your aerc configuration directory (usually ~/.config/aerc/), and add the following:
32-
33-
```
34-
[{account_name}]
35-
source = imaps+oauthbearer://{user}:{refresh_token}@imap.gmail.com:993?client_id={client_id}&client_secret={client_secret}&token_endpoint=https%3A%2F%2Foauth2.googleapis.com%2Ftoken
36-
outgoing = smtps+oauthbearer://{user}:{refresh_token}@smtp.gmail.com:465?client_id={client_id}&client_secret={client_secret}&token_endpoint=https%3A%2F%2Foauth2.googleapis.com%2Ftoken
37-
default = INBOX
38-
39-
```
40-
41-
{account_name} is whatever you would like to name this account in aerc.
42-
{user} is the email address you use to login to Gmail (same as in Step 2), except it should be URL-encoded (replace @ with %40).
43-
{refresh_token} is the refresh token you got from Step 2, except it should be URL-encoded (replace / with %2F).
44-
{client_id} and {client_secret} are the strings you got from Step 1.
45-
46-
!!! tip
47-
48-
You need to follow the directions from the oauth2.py script regarding redirect URIs:
49-
50-
```
51-
NOTE: The OAuth2 OOB flow isn't a thing anymore. You will need to set the
52-
application type to "Web application" and then add
53-
https://google.github.io/gmail-oauth2-tools/html/oauth2.dance.html as an
54-
authorised redirect URI. This is necessary for seeing the authorisation code on
55-
a page in your browser.
56-
```
25+
This creates a file at `~/.config/aerc/accounts.conf` with proper credentials. You might need to configure aerc to use this path instead of its default accounts.conf path.

0 commit comments

Comments
 (0)