/sdk-java

A Java library for interacting with the Tozny API. Tozny lets your users log in with their phone. Its one or two-factor authentication system is easy to use, easy to integrate, and cryptographically secure.

Primary LanguageJavaOtherNOASSERTION

Tozny Java SDK

Library interface to the Tozny authentication service. Use this Library to:

  • enroll or manage users
  • verify logins
  • manage user authentication devices
  • push challenge questions to user devices

Release

API Documentation

https://jitpack.io/com/github/tozny/sdk-java/2.2.1/javadoc/

Installing

The SDK can be installed via a Maven artifact, via the JitPack repository. If you use Gradle, add this configuration to your build.gradle configuration:

repositories {
  jcenter()
  maven { url "https://jitpack.io" }
}
dependencies {
  compile 'com.github.tozny:sdk-java:2.2.1'
}

Usage

Create an instance of RealmApi to make API calls to your Tozny realm.

import com.tozny.sdk.RealmApi;
import com.tozny.sdk.realm.RealmConfig;

// ...

RealmConfig config = new RealmConfig("YOUR_REALM_KEY_ID", "YOUR_REALM_KEY_SECRET");
RealmApi realm = new RealmApi(config);

Realm key id and secret are found in the realm key management section in the Tozny admin dashboard.

RealmApi exposes a number of methods interact with your realm. Many of these translate to HTTP calls to the Tozny API. For details, see the API documentation.

For a working example of SDK use, see the secretmessage example app. In particular, the SessionResource class demonstrates how to verify login requests.