maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
227 stars 24 forks source link

provide Oauth support instead of username/password #25

Closed jmdugan closed 5 years ago

jmdugan commented 7 years ago

did some research on what this would take, here are the background reading I found.

oauth overview https://www.mediawiki.org/wiki/Help:OAuth

very simple "Hello world" program to show how to use OAuth https://tools.wmflabs.org/oauth-hello-world/

background https://www.mediawiki.org/wiki/OAuth/For_Developers

propose app for oauth https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose

command line comparable https://stackoverflow.com/questions/5877326/command-line-tools-for-accessing-apis-with-oauth-support

command line oauth example with python http://www.benmccann.com/oauth-in-a-command-line-script/

node suggestions for mediawiki https://www.mediawiki.org/wiki/OAuth/For_Developers#Node.js https://www.npmjs.com/package/passport-mediawiki-oauth

maxlath commented 7 years ago

OAuth is now integrated to wikidata-edit (the lib that handles all write operations) since 28ef3ba so that's totally possible, the problem is more in the setup workflow. I note here the idea you suggested orally to output a URL the user would have to open in a browser before returning a token to save instead of entering a password.

For reference, here is the inventaire controller handling the 3 requests required

revi commented 6 years ago

Maybe let users make an owner-only consumer? They will get credentials to put upon registration and that will be enough. (Meanwhile, we have BotPasswords.)

nichtich commented 5 years ago

Maybe this setup workflow helps to simplify the "login" process (getting a fresh token if required): the user would get directed to a browser window but the script would get a token without need of manual copy & paste.

maxlath commented 5 years ago

OAuth authentification is now possible (and recommanded!) in wikibase-cli >= v8 \o/ see config documentation