Logout

Updated: May 17, 2017

SmartKey provides multiple interfaces to application developers. For C/C++ programmers, SmartKey provides a PKCS#11 interface through a library. For Java programmers, SmartKey can be accessed through the JCE interface. SmartKey can also be accessed through its RESTful interface, documented at http://support.smartkey.io/api/index.html

We provide examples for using SmartKey in 3 languages – a C++ program using the PKCS#11 interface, a Java program using the JCE interface, and a Python program using the REST interface.

Download the code to initialize and login. The example programs can be downloaded in full at http://support.smartkey.io/smartkey/resources.html


CK_RV logout(CK_FUNCTION_LIST_PTR p11, CK_SESSION_HANDLE hSession) {
	return p11->C_Logout(hSession);
}


private static boolean logout(Provider provider) {
    try {
        ((AuthProvider) provider).logout();
        return true;
    } catch (Exception e) {
        System.out.println("Can't logout: " + e);
        return false;
    }
}

def logout(bearer_token):
    res = requests.request(method='POST',
                           url="https://www.smartkey.io/sys/v1/session/terminate",
                           headers={'Authorization' : 'Bearer ' + bearer_token})
    if res.status_code != requests.codes.no_content:
        print "Can't logout: " + str(res.status_code)
    else:
        print "Logged out"