| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Overview
SecSign ID Api is a two-factor authentication api for Node.js
This API allows a secure login using a private key on a smart phone running SecSign ID by SecSign Technologies Inc. A complete tutorial for how to use the Node.js Api is found at https://www.secsign.com/nodejs-tutorial/ or just visit https://www.secsign.com for more information.
Files
Integration of the API
Download the SecSign ID Node.js API (SecSignIDApi.nodejs.js) and add it to your Node.js project.
Usage
// include SecSign ID Api for node.js
var SecSignIDApi = require('./SecSignIDApi.nodejs.js');
// the later auth session object
var authSession = null;
// call back function for the call of secSignIDApi.requestAuthSession(...)
var receivedAuthSessionCallback = function(authSessionObj){
if(authSessionObj.error){
console.log("Error " + authSessionObj.errorcode + " : " + authSessionObj.errormsg);
} else {
// create an authentication object. this stores the data about secsign id, request id and auth session id
authSession = new SecSignIDApi.AuthSession(authSessionObj);
secSignIDApi.getAuthSessionState({
"secsignid" : authSessionObj.secsignid,
"requestid" : authSessionObj.requestid,
"authsessionid" : authSessionObj.authsessionid
}, receivedAuthSessionStateCallback);
}
};
var authenticationSessionFor = {
"secsignid" : "zoidberg", // the secsign id itself
"servicename" : "Node.js test", // a name which will be shown in the push notification
"serviceaddress" : "localhost" // an address which is shown at top in the app, when user has to pick the correct access pass
};
// start by requesting an authentication session
secSignIDApi.requestAuthSession(authenticationSessionFor, receivedAuthSessionCallback);
// example for authentication session callback function. this is an example how to deal with the authentication state
var receivedAuthSessionStateCallback = function(authSessionObj){
if(authSessionObj.error){
console.log("Error " + authSessionObj.errorcode + " : " + authSessionObj.errormsg);
} else {
// check which state the session has
// PENDING, EXPIRED, AUTHENTICATED, DENIED, SUSPENDED, CANCELED, FETCHED, INVALID, NOSTATE
if(authSessionObj.authsessionstate == SecSignIDApi.AuthSession.PENDING){
console.log("the authentication session is pending");
// check again..
}
if(authSessionObj.authsessionstate == SecSignIDApi.AuthSession.AUTHENTICATED){
//release authSession and log user in
secSignIDApi.releaseAuthSession(authSession, userIsLoggedInCallback);
// now, we can login user here at our backend/system etc
}
}
};Tutorial
A complete tutorial with the examples can be found at https://www.secsign.com/nodejs-tutorial/.
===============
SecSign Technologies Inc. official site: https://www.secsign.com
| Back | FazBrowse Home | New Git URL |