Unrecoverable error when authorization fails

Bug #814595 reported by Jonathan Lange on 2011-07-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
launchpadlib
Critical
Unassigned

Bug Description

I just tried writing a very simple launchpadlib application that logs in to staging. The call to login_with failed with this error::

Traceback (most recent call last):
  File "pkgme/upload.py", line 14, in get_launchpad
    return Launchpad.login_with(APPLICATION_NAME, service_root, CACHE_DIR)
  File "/usr/lib/pymodules/python2.7/launchpadlib/launchpad.py", line 538, in login_with
    credential_save_failed, version)
  File "/usr/lib/pymodules/python2.7/launchpadlib/launchpad.py", line 358, in _authorize_token_and_login
    service_root, cache, timeout, proxy_info, version)
  File "/usr/lib/pymodules/python2.7/launchpadlib/launchpad.py", line 197, in __init__
    credentials, service_root, cache, timeout, proxy_info, version)
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 445, in __init__
    self._wadl = self._browser.get_wadl_application(self._root_uri)
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/_browser.py", line 299, in get_wadl_application
    response, content = self._request(url, media_type=wadl_type)
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/_browser.py", line 281, in _request
    raise error
lazr.restfulclient.errors.Unauthorized: HTTP Error 401: Unauthorized
Response headers:
---
-content-encoding: gzip
content-length: 44
content-type: text/plain
date: Fri, 22 Jul 2011 11:51:49 GMT
server: zope.server.http (HTTP)
status: 401
vary: Accept-Encoding
via: 1.1 wildcard.staging.launchpad.net
x-powered-by: Zope (www.zope.org), Python (www.python.org)
---
Response body:
---
Unknown access token (cDBX2n5zxnfM9cLxjK30).
---

It took me a very, very long time to figure out that the way to "work around" this error was to:
 1. Run "Password and Encryption Keys" (found in System Settings)
 2. Look for the passwords called "Network password"
 3. For each one:
     a) Right-click and go to Properties
     b) Click on the Details tab
     c) Scroll right until I can see the full URL for the "user"
 4. Find the one for staging.launchpad.net, then delete it
 5. Re-run the application, go through the authorization dance

Note that the error does not:
 * give any reason for why I'm suddenly unauthorized
 * provide any guidance on how to re-gain authorization
 * mention "Network password" and only subtly mentions 'launchpadlib' or 'staging.launchpad.net'

I only found out about "Network password" because james_w told me so.

Thus, as someone trying to write an application based on launchpadlib, I have no idea how to present such an exception to my users.

I don't know what caused the de-authorization in the first place. On #launchpad-dev, Steve Kowalik said:

  <StevenK> I seem to recall something like that.
  <StevenK> It usually happens when we blow up the session database.

Changed in launchpadlib:
status: New → Triaged
importance: Undecided → Low

On Mon, Jul 25, 2011 at 12:51 PM, Данило Шеган
<email address hidden> wrote:
> ** Changed in: launchpadlib
>       Status: New => Triaged
>
> ** Changed in: launchpadlib
>   Importance: Undecided => Low

When did Launchpad decide that cryptic crasher bugs were low priority?

jml

Changed in launchpadlib:
importance: Low → Critical
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers