Page MenuHomePhabricator

OAuth login from paws under different user not working / not documented properly
Closed, DeclinedPublic


I need help (maybe @Tgr, @yuvipanda)
I'm trying to configure a bot access from paws, the bot account is different from my user.

when doing login

I get the error message Logged in on wikipedia:de via OAuth as Herzi Pinki, but expect as ISO 3166 Bot


family  = "wikipedia"
usernames['wikipedia']['de'] = u'ISO 3166 Bot'

I used my global account Herzi Pinki to log in with OAuth to paws. How can I change user on paws to run my scripts under the bot user?
(I tried to set up paws access for the other user 'ISO 3166 Bot', could authenticate via OAuth, but then could not start myServer. See T185434).


Traceback (most recent call last):
  File "/srv/paws/pwb/", line 264, in <module>
    if not main():
  File "/srv/paws/pwb/", line 257, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "/srv/paws/pwb/", line 121, in run_python_file
  File "/srv/paws/pwb/scripts/", line 196, in <module>
  File "/srv/paws/pwb/scripts/", line 179, in main
    site.login(sysop, autocreate=autocreate)
  File "/srv/paws/pwb/pywikibot/", line 2108, in login
pywikibot.exceptions.NoUsername: Logged in on wikipedia:de via OAuth as Herzi Pinki, but expect as ISO 3166 Bot
CRITICAL: Closing network session.
<class 'pywikibot.exceptions.NoUsername'>

Event Timeline

As the error message suggests, the user in the pywikibot configuration and the user to which the OAuth credentials belong are different. So this is not a bug as far as Pywikibot / OAuth are concerned (suggestions on how to explain the situation better are welcome, though). I don't know enough about PAWS to comment, but I assume you just need to create the OAuth credentials with the right user.

thanks @Tgr. Is there a plain guideline on how to run a bot from paws under a different user? Did not succeed in finding one.

Chicocvenancio added a subscriber: Chicocvenancio.

@Herzi.Pinki I don't think it is a good idea to attempt to OAuth as a different user. Currently, I think it is not possible either. Pywikibot will disable logout once you login through OAuth, PAWS will log you in when you start the notebook to your current user. Password authentication is also disabled by pywikibot if you have OAuth enabled, while reauthenticating as your bot might work, that would require you to place access tokens and secrets in a publicly visible file, effectively giving the world access to your bot account.
In all, the current supported way to achieve this it to login with the bot account and go to PAWS from there.

Sorry, understand now, why OAuth is the wrong way to try. Thanks for your patience.

But I came here because creating a server for my bot account failed. If you could courteously help me on T185434. regards

You can close this either way. I was helped on T185434.

Marking as declined as this is an unlikely feature to be developed.