Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./bin/inbox-console -e [email protected] leads to an exception if no OAuth token is set on it #439

Open
alexanderadam opened this issue Feb 23, 2017 · 0 comments

Comments

@alexanderadam
Copy link

alexanderadam commented Feb 23, 2017

I wanted to remove an account because ./bin/inbox-auth [email protected] --reauth creates duplicates and I obviously wanted to get rid of these.

So I tried to enter the console with ./bin/inbox-console -e [email protected] as described. But it seems that one (the first account) doesn\t have the OAuth token set and this results in the following exception:

Traceback (most recent call last):
  File "./bin/inbox-console", line 31, in <module>
    console()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 488, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 474, in main
    self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 659, in invoke
    ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 325, in invoke
    return callback(*args, **kwargs)
  File "./bin/inbox-console", line 27, in console
    start_console(email_address)
  File "/opt/sync-engine/inbox/console.py", line 63, in start_console
    user_console(user_email_address)
  File "/opt/sync-engine/inbox/console.py", line 38, in user_console
    with writable_connection_pool(account.id, pool_size=1).get()\
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/opt/sync-engine/inbox/crispin.py", line 181, in get
    client = self._new_connection()
  File "/opt/sync-engine/inbox/crispin.py", line 235, in _new_connection
    conn = self._new_raw_connection()
  File "/opt/sync-engine/inbox/crispin.py", line 232, in _new_raw_connection
    account, self._should_timeout_connection())
  File "/opt/sync-engine/inbox/auth/oauth.py", line 34, in connect_account
    self._authenticate_IMAP_connection(account, conn)
  File "/opt/sync-engine/inbox/auth/gmail.py", line 61, in _authenticate_IMAP_connection
    token = g_token_manager.get_token_for_email(account)
  File "/opt/sync-engine/inbox/models/backends/gmail.py", line 81, in get_token_for_email
    return self.get_token(account, GOOGLE_EMAIL_SCOPE, force_refresh)
  File "/opt/sync-engine/inbox/models/backends/gmail.py", line 77, in get_token
    gtoken = self._get_token(account, scope, force_refresh=force_refresh)
  File "/opt/sync-engine/inbox/models/backends/gmail.py", line 63, in _get_token
    gtoken = account.new_token(scope)
  File "/opt/sync-engine/inbox/models/backends/gmail.py", line 244, in new_token
    raise OAuthError("No valid tokens")
inbox.basicauth.OAuthError: No valid tokens

I'm using sync engine 17.1.6.

My workaround was for now:

./bin/get-object --account-id 1
obj.mark_deleted
obj.disable_sync("account deleted")
db_session.commit()

and finally ./bin/delete-account-data 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant