WolfgangFahl / Mediawiki-Japi

Client for Mediawiki Api
Apache License 2.0
11 stars 7 forks source link

Login with OAuth #44

Closed benjavalero closed 5 years ago

benjavalero commented 5 years ago

I have a tool using this fantastic library. However, in order to be used by several users, I have had to implement OAuth authentication, so I no longer login with the library (user / password). Thus, I have had to implement the edit method by myself.

I guess I could separate the edit method, to be able to receive an edit token generated outside the library. Or even add an implementation of getEditToken using an access token as a parameter.

Which one do you think it is the best approach ?

Thanks in advance,

WolfgangFahl commented 5 years ago

You might want to look into SSLWiki which also has a separated login method. So having an OAuthWiki extending com.bitplan.mediawiki.japi.Mediawiki and implementing MediawikiApi might be the way to go. At this point i do not understand your Use Case enough to be sure what to recommend. What are you automating that you'd like to use several accounts? For most of my use cases i simply create a separate bot account with special rights (e.g. API access). Giving a lot of users API access might give you extra headaches.

benjavalero commented 5 years ago

Thanks a lot for your answer. I already have a bot account to be used to automatized tasks. The purpose of this tool is to be able to modify just little pieces of text, mainly to fix spelling errors, but manually from a web interface.

On the other hand, I have debugged and found that, when retrieving the edit token, the current logged user is taken from the cookies set from the previous login. Thus I don't see an easy way of passing the OAuth access token.

So for the moment I will keep my current use of the library and close the question. Thanks again.