Skip to content

Instantly share code, notes, and snippets.

@Aschen
Last active October 16, 2019 07:19
Show Gist options
  • Select an option

  • Save Aschen/5b2f8a5d7c64a674591c5d683442b38d to your computer and use it in GitHub Desktop.

Select an option

Save Aschen/5b2f8a5d7c64a674591c5d683442b38d to your computer and use it in GitHub Desktop.
Kuzzle Java SDK Login
import io.kuzzle.sdk.core.Kuzzle;
import io.kuzzle.sdk.core.Options;
Options options = new Options();
options
.setAutoReconnect(true),
.setPort(7512);
Kuzzle kuzzle = new Kuzzle("106.75.172.117", options, new ResponseListener<Void>() {
@Override
public void onSuccess(Void object) {
Kuzzle kuzzleSdk = (Kuzzle) object;
JSONObject credentials1 = new JSONObject()
.put("username", "liujiang")
.put("password", "123456");
kuzzle.connect();
// "local" is the name of the auth strategy, not a server host
kuzzle.login("local", credentials1, 30000, new ResponseListener<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
// ...
}
}
}
@Override
public void onError(JSONObject error) {
// Handle connection error
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment