Using Imap with Gmail and Oauth2

.

Google introduced a policy in 2024 that access to all its online services need Oauth2 authorization Oauth2 It was stated that a Linux client must use a "webserver" type. I didn't want this since it requres a URI. The ""Desktop" type worked for me since all the codes are private. The token exchange process is complicated. Google has published a prebuilt (for Intel and ARM) token exchange program oauth2l which makes this much easier. It will fetch a login token using the secret generated by the Google site when you set up the application.