= Managing OAuth access tokens = All access tokens and request tokens for a given user can be seen and/or revoked from that user's +oauth-tokens page. >>> from zope.component import getUtility >>> from lp.registry.interfaces.person import IPersonSet >>> from lp.services.webapp.interfaces import OAuthPermission # Create a desktop integration token. >>> login('salgado@ubuntu.com') >>> consumer = factory.makeOAuthConsumer( ... "System-wide: Ubuntu (mycomputer)") >>> salgado = getUtility(IPersonSet).getByName('salgado') >>> desktop_token = factory.makeOAuthAccessToken( ... consumer, salgado, OAuthPermission.DESKTOP_INTEGRATION) # Create a request token, authorize it for READ_PRIVATE access, # but don't exchange it for an access token. >>> consumer = factory.makeOAuthConsumer( ... "Example consumer for READ_PRIVATE") >>> request_token = factory.makeOAuthRequestToken() >>> request_token.review(salgado, OAuthPermission.READ_PRIVATE) >>> logout() # View the tokens. >>> my_browser = setupBrowser(auth='Basic salgado@ubuntu.com:zeca') >>> my_browser.open('http://launchpad.dev/~salgado/+oauth-tokens') >>> print my_browser.title Authorized applications... >>> main_content = find_tag_by_id(my_browser.contents, 'maincontent') >>> print extract_text(main_content) Authorized applications ... Claimed tokens: Application name: System-wide: Ubuntu (mycomputer) Authorized...to integrate an entire system Application name: foobar123451432 Authorized...to read non-private data Application name: launchpad-library Authorized...to change anything Unclaimed tokens: Application name: oauthconsumerkey... Authorized...to read anything Must be claimed before For each token we have a separate