wandera / 1password-client

Python wrapper for OnePassword CLI developed at Wandera.
MIT License
47 stars 25 forks source link

Timeout Error #31

Closed dale-courtney closed 3 years ago

dale-courtney commented 3 years ago

I can successfully run the following:

from onepassword import OnePassword import json op = OnePassword()

I'm able to successfully input all of the requested info (email_address, domain_name, account_name, secret_key, password). I do have 2FA enabled, but I am not prompted for my 2FA.

When I run the following:

_json.loads(op.listvaults())

I get the following error every time:

_Traceback (most recent call last): File "", line 4, in File "/usr/local/lib/python3.9/site-packages/onepassword/client.py", line 44, in init self.first_use() File "/usr/local/lib/python3.9/site-packages/onepassword/client.py", line 76, in first_use self.signin_wrapper(account, signin_domain, email_address, secret_key) File "/usr/local/lib/python3.9/site-packages/onepassword/client.py", line 103, in signin_wrapper password, session_key, domain, account, bp = self._signin(account, domain, email, secret_key, master_password) File "/usr/local/lib/python3.9/site-packages/onepassword/client.py", line 172, in _signin sess_key = _spawn_signin(op_command, master_password) File "/usr/local/lib/python3.9/site-packages/onepassword/utils.py", line 80, in _spawn_signin resp = child.expect(['Enter your six-digit authentication code:', pexpect.EOF]) File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 343, in expect return self.expect_list(compiled_pattern_list, File "/usr/local/lib/python3.9/site-packages/pexpect/spawnbase.py", line 372, in expect_list return exp.expect_loop(timeout) File "/usr/local/lib/python3.9/site-packages/pexpect/expect.py", line 181, in expect_loop return self.timeout(e) File "/usr/local/lib/python3.9/site-packages/pexpect/expect.py", line 144, in timeout raise exc pexpect.exceptions.TIMEOUT: Timeout exceeded. <pexpect.pty_spawn.spawn object at 0x10a0e23d0> command: /usr/local/bin/op args: ['/usr/local/bin/op', 'signin', 'domain', 'email_address', 'secret_key', '--raw', '--shorthand', 'name'] buffer (last 100 chars): b'in.\r\nEnter the Secret Key for email_address at signin_domain: ' before (last 100 chars): b'in.\r\nEnter the Secret Key for email_address at signin_domain: ' after: <class 'pexpect.exceptions.TIMEOUT'> match: None match_index: None exitstatus: None flag_eof: False pid: 82848 child_fd: 8 closed: False timeout: 30 delimiter: <class 'pexpect.exceptions.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcherre: 0: re.compile(b'Enter your six-digit authentication code:') 1: EOF

dtpryce commented 3 years ago

A weird one since new release we have had a couple timeouts which are due to regex for master password not matching we think. Can you tell me the general format of the account and 1password domain you are using?

dtpryce commented 3 years ago

I just tested using 2FA in my personal machine (Mac M1) and in an ubuntu docker image using python 3.8. Nothing seemed to be wrong there. If you can share what values or even basic format of the email, domain and account you are trying to set. That can help us debug the issue with the regex plus tell us a little more about your environment so we can test the client including system, os, op --version and python --version. Thanks!

dale-courtney commented 3 years ago

These are provided with yes/no choices:

Input:

Thanks for looking at this for me.

Best, Dale

dale-courtney commented 3 years ago

OK, call me stupid. When the script prompted me for the account name, I went with the default provided. But that's not actually the account name but the domain name. I'm so sorry for sending everyone on a wild goose chase.

dtpryce commented 3 years ago

Hahaha no worries! Glad it's working for you now! Could we make our docs or logging clearer?