use of org.wikidata.wdtk.wikibaseapi.LoginFailedException in project OpenRefine by OpenRefine.
the class ConnectionManager method login.
/**
* Logs in to the Wikibase instance, using username/password.
* <p>
* If failed to login, the connection will be set to null.
*
* @param mediaWikiApiEndpoint the api endpoint of the target Wikibase instance
* @param username the username to log in with
* @param password the password to log in with
* @return true if logged in successfully, false otherwise
*/
public boolean login(String mediaWikiApiEndpoint, String username, String password) {
BasicApiConnection connection = new BasicApiConnection(mediaWikiApiEndpoint);
setupConnection(connection);
try {
connection.login(username, password);
endpointToConnection.put(mediaWikiApiEndpoint, connection);
return true;
} catch (LoginFailedException e) {
logger.error(e.getMessage(), e);
return false;
}
}
Aggregations