Page MenuHomePhabricator

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

Description

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

pwb.py login

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

my user-config.py:

family  = "wikipedia"
mylang='de'
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:

Traceback (most recent call last):
  File "/srv/paws/pwb/pwb.py", line 264, in <module>
    if not main():
  File "/srv/paws/pwb/pwb.py", line 257, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "/srv/paws/pwb/pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File "/srv/paws/pwb/scripts/login.py", line 196, in <module>
    main()
  File "/srv/paws/pwb/scripts/login.py", line 179, in main
    site.login(sysop, autocreate=autocreate)
  File "/srv/paws/pwb/pywikibot/site.py", line 2108, in login
    right=self._username[sysop]))
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

Tgr added a comment.Jan 29 2018, 11:51 PM

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 triaged this task as Low priority.Jan 30 2018, 1:46 PM
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.

Chicocvenancio closed this task as Declined.Jan 30 2018, 5:16 PM

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