mozilla / f1

INACTIVE - http://mzl.la/ghe-archive - F1 is a browser extension that allows you to share links in a fast and fun way. Share links from within the browser, from any webpage, using the same services you already know and love. F1 is made by Mozilla.

Home Page:http://f1.mozillamessaging.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yahoo profiles don't always contain the data we need.

mhammond opened this issue · comments

I just created a test yahoo account and attempted to authorize it. F1 responds with:

Traceback (most recent call last):
  File "O:\src\mm\f1\work\linkdrop\controllers\account.py", line 119, in verify
    user = auth.verify()
  File "O:\src\mm\f1\work\linkdrop\lib\oauth\openidconsumer.py", line 354, in verify
    return self._get_credentials(result_data)
  File "O:\src\mm\f1\work\linkdrop\lib\oauth\yahoo_.py", line 101, in _get_credentials
    username = profile['preferredUsername']
KeyError: 'preferredUsername'

I hacked the code to dump the profile and it was:

{'identifier': u'https://me.yahoo.com/a/xxx..#25f15',
 'name': {'formatted': None},
 'providerName': 'Yahoo',
 'verifiedEmail': u'xxx@yahoo.com.au'}

The profile seems strange as I did enter a name when creating the profile - maybe the error is due to the account being so new - I'll let you know if it ever changes.

While we can probably handle this case given we don't actually use the 'preferredUsername' field, note that the profile also lacks the 'xoauth_yahoo_guid' item - which we do use for fetching contacts. Dealing with this latter field missing is the reason I didn't just fix the error relating to preferredUsername (actually, I did fix it, then hit a KeyError for the latter field :)

OK - so I went to the "profile" page in yahoo and noticed it saying "activated his profile" 30 seconds ago (which was long after I created the account). After that it worked correctly - so it seems this error is related to the profile not being "activated"