Xqt added a subscriber: VcamX.
Xqt added a comment.

  The `mwoauth.identify` function is used in login script 
<https://doc.wikimedia.org/pywikibot/master/utilities/scripts_ref.html#module-pywikibot.scripts.login>
 to verify that the expected user is logged in (and by tests btw). See 
login_one_site and _oauth_login 
<https://doc.wikimedia.org/pywikibot/master/_modules/pywikibot/scripts/login.html#login_one_site>
 methods. They were introduced with T102602 
<https://phabricator.wikimedia.org/T102602> (rPWBC8624ddec 
<https://phabricator.wikimedia.org/rPWBC8624ddec140253ec46e0f39c1f5bdb05184840ff>):
  
    def _oauth_login(site) -> None:
        consumer_key, consumer_secret = _get_consumer_token(site)
        login_manager = OauthLoginManager(consumer_secret, site, consumer_key)
        login_manager.login()
        identity = login_manager.identity
        if identity is None:
            pywikibot.error(f'Invalid OAuth info for {site}.')
        elif site.username() != identity['username']:
            pywikibot.error(
                'Logged in on {site} via OAuth as {wrong}, but expect as 
{right}'
                .format(site=site,
                        wrong=identity['username'], right=site.username()))
        else:
            oauth_token = login_manager.consumer_token + 
login_manager.access_token
            pywikibot.info(
                f'Logged in on {site} as {site.username()} via OAuth consumer '
                f'{consumer_key}\nNOTE: To use OAuth, you need to copy the'
                ' following line to your user config file:\n'
                f'authenticate[{site.hostname()!r}] = {oauth_token}'
            )

TASK DETAIL
  https://phabricator.wikimedia.org/T408721

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to