Set up OAuth 2.0 for Gmail SET UP OAUTH2 ON GOOGLE: Based on: https://support.google.com/googleapi/answer/6158849 1. Log in to your Gmail account on the https://accounts.google.com/signin page. 2. Open the Google API console on the https://console.developers.google.com/ page. 3. Choose your country if it isn't already chosen in the drop-down menu. 4. Read the information in the links in the "Terms of Service" section and check the box to agree with them. 5. Click the "AGREE AND CONTINUE" button. 6. Click the "CREATE PROJECT" link on the right. 7. Leave the suggested project name or rename it (I rename it with my email username). 8. Click the "CREATE" button at the bottom of the window. 9. Open the project you created by clicking "SELECT PROJECT" from the notification in the upper right corner. 10. Click "Credentials" in the menu on the left. 11. Click "CONFIGURE CONSENT SCREEN" on the right. 12. Choose the "External" radio button in the "User Type" section. 13. Click the "CREATE" button. 14. Fill in your Gmail user name as the "App name" in the "App information" section. 15. Choose your full Gmail address from the drop-down menu as the "User support email" in the "App information" section. 16. Browse to an image to use as the "App logo" if you like in the "App information" section. 17. Click "+ADD DOMAIN" in the "Authorized domains" section. 18. Paste "google.com" into the "Authorized domain 1" box. 19. Fill in your full Gmail address in the "Developer contact information" section's box 20. Click "SAVE AND CONTINUE". 21. Click "ADD OR REMOVE SCOPES" at the top of the page 22. Put a check-mark in the "Gmail API" entry's box if it's in the list or paste the https://mail.google.com/ URL manually into the text box at the bottom of the list if it's not there, clicking ADD TO TABLE and it will be selected for you. 23. Click on "UPDATE". 24. Scroll down to the "Your restricted scopes" section and make sure it shows the entry that you just added. 25. Click on "SAVE AND CONTINUE". 26. The initial publishing status will be "Testing". To set this up, click "+ ADD USERS". 27. Type in your full Gmail address and click "ADD" twice. 28. Check if the address was added to the "Test Users" section. If not, repeat steps 21 and 22. 29. Click "SAVE AND CONTINUE". At this point, I got an "Ineligible accounts message telling me that my email account was not added and I just clicked the "CLOSE" button on that message.. 30. Click "BACK TO DASHBOARD". 31. Click "Credentials" on the left. 32. Click "+ CREATE CREDENTIALS". 33. Click "Oauth Client ID". 34. Choose "Desktop Application". 35. Leave the name as is or type "Claws Mail" into the "Name" field. 36. Click the "CREATE" button. 37. You'll receive a pop-up containing your "Your Client ID" and "Your Client secret" and an offer to download them in JSON format if you like. NOTE: The initial "Publishing status" in step 18 above is "Testing". In "Testing" status, each authorization code will only last for 7 days, after which you’ll be unable to connect and will see authorization errors in the network log. To get a new authorization code, go to the "OAuth2" page of the Claws Mail settings and repeat the steps for getting an authorization code and completing authorization (starting at step 13 above). Note that there's no need to get a new Client ID or Client secret. NOTE: To change the status from "Testing" to "In Production" (which has no time limits on the authorization code): 1. Click the "PUBLISH APP" button in the "Publishing status" section of the "OAuth consent screen" (also referred to by Google as the dashboard). 2. Click on "Confirm". 3. This changes the status to "In Production" and displays a new "Verification Status" section with a "Needs verification" status that can be safely ignored. If that doesn't work for some reason, you can switch back to "Testing" status on the same "OAuth consent screen" and remember to make sure that you've added your Gmail address to the "Test Users" list on the "Edit App Registration - 'Test Users'" page of the "OAuth Consent Screen" setup process (or on the main "OAuth Consent Screen" page). SET UP OAUTH2 IN CLAWS MAIL: 1. Open the "Configuration" menu in Claws Mail. 2. Choose "Edit accounts…" from the menu. 3. Choose your Gmail account. 4. Click the "Edit" button. 5. Pick one: ◦ If this is a POP account: 1. Click "Receive" in the left pane. 2. Put a check-mark in the "Authenticate before POP connection" box. 3. Choose "OAuth2" from the "Authentication method" drop-down menu. 4. Click the "Apply" button. ◦ If this is an IMAP account: 1. Click "Receive" in the left pane. 2. Choose "OAuth2" from the "Authentication method" drop-down menu. 3. Click the "Apply" button. 6. Click "Send" in the left pane. 7. Choose "OAuth2" from the "Authentication method" drop-down menu. 8. Click the "Apply" button. 9. Click "OAuth2" in the left pane. 10. Change the "Select OAuth2 Email Service Provider" drop-down to "Google/Gmail". 11. Paste the "Your Client ID" you got in step 30 in the above instruction set into the "Client ID" box. 12. Paste the "Your Client secret" you got in step 30 in the above instruction set into "Client secret" box. 13. Click the "Open default browser with request" button. 14. Choose your Gmail account. 15. Click the "Continue" link. 16. Click the "Continue" link. 17. Copy the authorization code it gives you. 18. Paste the code into the "Authorization" code box in Claws Mail. 19. Click the "Authorize" button. 20. Click "Apply". 21. Click "OK". 22. Close Claws Mail. Note that steps 20 and 21 may be unnecessary. I got an invalid certificate and had to cancel the connection, so I didn't get that far.