use of org.mediawiki.api.ApiResult in project apps-android-commons by commons-app.
the class MWApi method login.
/**
* @param username String
* @param password String
* @param twoFactorCode String
* @return String as returned by this.getErrorCodeToReturn()
* @throws IOException On api request IO issue
*/
public String login(String username, String password, String twoFactorCode) throws IOException {
//TODO cache this instead of calling again when 2FAing
String token = this.getLoginToken();
ApiResult loginApiResult = this.action("clientlogin").param("rememberMe", "1").param("username", username).param("password", password).param("logintoken", token).param("logincontinue", "1").param("OATHToken", twoFactorCode).post();
return this.getErrorCodeToReturn(loginApiResult);
}
Aggregations