Code Monkey home page Code Monkey logo

Comments (8)

marcelolaia avatar marcelolaia commented on May 22, 2024

offlineimap work very nice without any issues.

from gmail-oauth2-tools.

shiben-lab avatar shiben-lab commented on May 22, 2024

@marcelolaia Could you please share the offlineimap change details ? I am also stuck in the above issue you have mentioned here.

from gmail-oauth2-tools.

marcelolaia avatar marcelolaia commented on May 22, 2024

@marcelolaia Could you please share the offlineimap change details ? I am also stuck in the above issue you have mentioned here.

Hi @shiben-lab, I'm so sorry for delay in replay.
I have been set up my .offlineimaprc like the instructions here.
The relevant part is:

[Repository ExampleCompanyRemote]
type = IMAP
remotehost = imap.gmail.com
remoteuser = myuser
ssl = yes
starttls = no
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
auth_mechanisms = XOAUTH2
oauth2_client_id = YOUR_CLIENT_ID_HERE
oauth2_client_secret = YOUR_CLIENT_SECRET_HERE
oauth2_request_url = https://accounts.google.com/o/oauth2/token
oauth2_refresh_token = YOUR_REFRESH_TOKEN_HERE

Please, tell me if you have solved your issue.

My msmtp issue continue unsolved.

from gmail-oauth2-tools.

marcelolaia avatar marcelolaia commented on May 22, 2024

I tried it with python 3.8 and it not run:

 Traceback (most recent call last):
  File "/usr/lib/python3.8/urllib/request.py", line 1350, in do_open h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.8/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.8/http/client.py", line 1010, in _send_output self.send(msg)
  File "/usr/lib/python3.8/http/client.py", line 950, in send self.connect()
  File "/usr/lib/python3.8/http/client.py", line 1417, in connect super().connect()
  File "/usr/lib/python3.8/http/client.py", line 921, in connect self.sock = self._create_connection(
  File "/usr/lib/python3.8/socket.py", line 787, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./oauth2.py", line 366, in <module> main(sys.argv)
  File "./oauth2.py", line 344, in main response = AuthorizeTokens(options.client_id, options.client_secret,
  File "./oauth2.py", line 228, in AuthorizeTokens response = urlopen(request_url, data).read()
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1393, in https_open return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.8/urllib/request.py", line 1353, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>

from gmail-oauth2-tools.

MunifTanjim avatar MunifTanjim commented on May 22, 2024

Hey @marcelolaia,

If you are still stuck, you can try this minimal script I wrote for myself: gmail-oauth2_none_none.sh

It just requires bash, curl and jq on your system.

from gmail-oauth2-tools.

marcelolaia avatar marcelolaia commented on May 22, 2024

Hi @MunifTanjim, thank you so much! Please, could you share the needed configurations to do? You use it with msmtp?

from gmail-oauth2-tools.

MunifTanjim avatar MunifTanjim commented on May 22, 2024

You use it with msmtp?

Yes.

You can put this in your msmtp config:

auth oauthbearer
passwordeval "gmail-oauth2.sh access_token --client-id CLIENT_ID --client-secret CLIENT_SECRET --refresh_token REFRESH_TOKEN"

You can get the REFRESH_TOKEN by running this:

gmail-oauth2.sh refresh_token --client-id CLIENT_ID --client-secret CLIENT_SECRET

If you don't want to put these sensitive CLIENT_SECRET or REFRESH_TOKEN in your config file you can take a look at another script that I actually use: gmail-oauth2_bitwarden_secret-tool.sh

It needs Bitwarden CLI bw and secret-tool. With it, I just put these in my configs:

# msmtp
auth oauthbearer
passwordeval "gmail-oauth2.sh access_token [email protected]"

# mbsync
AuthMechs XOAUTH2
PassCmd "gmail-oauth2.sh access_token [email protected]"

from gmail-oauth2-tools.

junyer avatar junyer commented on May 22, 2024

Fixed in commit 944cffd.

from gmail-oauth2-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.