{"_id":"560541907c8e580d0001afe8","__v":28,"version":{"_id":"55edea207145f717001ac12f","project":"55edea207145f717001ac12c","__v":11,"createdAt":"2015-09-07T19:48:48.670Z","releaseDate":"2015-09-07T19:48:48.670Z","categories":["55edea217145f717001ac130","55ffa8038c0c9d0d00dcac72","55ffbaa48c0c9d0d00dcac88","55ffbd3e8c0c9d0d00dcac8b","55ffbee40e2b090d00863393","55ffc4306932a00d00ba7a85","55ffc66bfeaf310d007dd6c8","55ffc9c2feaf310d007dd6d1","55ffceca0e2b090d008633b2","560111b06811d00d00ceb34e","560262e74f15002100ee4445"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"55ffceca0e2b090d008633b2","pages":["55ffcedffeaf310d007dd6d6","55ffd0879e7ccf0d000a1e09","55ffddd1feaf310d007dd6e8","55ffdee4feaf310d007dd6ea","55ffe2336932a00d00ba7abf","55ffeb898c0c9d0d00dcacd0","55fff74c6932a00d00ba7b0c","55fff9df0c703d1900952fe1","55fffecb6932a00d00ba7b1b","55ffffd49e7ccf0d000a1e49","560001159e7ccf0d000a1e4d","560004126932a00d00ba7b2a","560006ef0c703d1900952ffc","560009fa8c0c9d0d00dcad0d","5601137f9137690d00335697","560120f34ea1b40d003bf1a4","5601221bf01fb90d00d4bf7e","5601274781a9670d006d1514","5601292881a9670d006d1516","56012ab3f01fb90d00d4bf88","56012c754ea1b40d003bf1b9","56012d824ea1b40d003bf1c0","56053e9df6b86e0d00284ad1","560541907c8e580d0001afe8","56123c063cf4bc0d00554e37","561264c70157131900b45863","561272d60157131900b45870","5612796d09bdc51700696fdf","56138c7a6fd7042b008f0187","5613a63d46c35f3500773c06","5613a79a44d6662b0071f5d9"],"project":"55edea207145f717001ac12c","version":"55edea207145f717001ac12f","__v":31,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-21T09:32:58.200Z","from_sync":false,"order":0,"slug":"sdk","title":"SDK"},"user":"55ede9ed1452cd0d009e5e6b","project":"55edea207145f717001ac12c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-25T12:44:00.822Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":27,"body":"To initialize the library you need to instantiate a Rublon2Factor class object. Its constructor takes three arguments.\n\n[block:html]\n{\n  \"html\": \"<div>\\n\\n  <!-- Nav tabs -->\\n  <ul class=\\\"nav nav-tabs langnav\\\" role=\\\"tablist\\\">\\n    <li role=\\\"presentation\\\" class=\\\"active\\\"><a href=\\\"#php\\\" aria-controls=\\\"php\\\" role=\\\"tab\\\" data-toggle=\\\"tab\\\">PHP</a></li>\\n    <li role=\\\"presentation\\\"><a href=\\\"#net\\\" aria-controls=\\\"net\\\" role=\\\"tab\\\" data-toggle=\\\"tab\\\">.NET</a></li>\\n    <li role=\\\"presentation\\\"><a href=\\\"#java\\\" aria-controls=\\\"java\\\" role=\\\"tab\\\" data-toggle=\\\"tab\\\">Java</a></li>\\n    <li role=\\\"presentation\\\"><a href=\\\"#python\\\" aria-controls=\\\"python\\\" role=\\\"tab\\\" data-toggle=\\\"tab\\\">Python</a></li>\\n  </ul>\\n\\n  <!-- Tab panes -->\\n  <div class=\\\"tab-content\\\">\\n    <div role=\\\"tabpanel\\\" class=\\\"tab-pane active\\\" id=\\\"php\\\">\\n<table>\\n\\t<caption><code>Rublon2Factor</code> class constructor arguments</caption>\\n\\t<thead><tr>\\n\\t\\t<th>Name</th>\\n\\t\\t<th>Type</th>\\n\\t\\t<th>Description</th>\\n\\t</tr></thead>\\n\\t<tbody>\\n\\t\\t<tr><td><code>$systemToken</code></td><td>string</td><td>Your system's public Id</td></tr>\\n\\t\\t<tr><td><code>$secretKey</code></td><td>string</td><td>Secret key</td></tr>\\n\\t\\t<tr><td><code>$apiServer</code></td><td>string</td><td>(optional) API Server URI</td></tr>\\n\\t</tbody>\\n</table>    \\n    </div>\\n    <div role=\\\"tabpanel\\\" class=\\\"tab-pane\\\" id=\\\"net\\\">\\n<table>\\n\\t<caption><code>Rublon2Factor</code> class constructor arguments</caption>\\n\\t<thead><tr>\\n\\t\\t<th>Name</th>\\n\\t\\t<th>Type</th>\\n\\t\\t<th>Description</th>\\n\\t</tr></thead>\\n\\t<tbody>\\n\\t\\t<tr><td><code>systemToken</code></td><td>string</td><td>Your system's public Id</td></tr>\\n\\t\\t<tr><td><code>secretKey</code></td><td>string</td><td>Secret key</td></tr>\\n\\t\\t<tr><td><code>apiServer</code></td><td>string</td><td>(optional) API Server URI</td></tr>\\n\\t</tbody>\\n</table>    \\n    </div>\\n    <div role=\\\"tabpanel\\\" class=\\\"tab-pane\\\" id=\\\"java\\\">\\n    <table>\\n\\t<caption><code>Rublon2Factor</code> class constructor arguments</caption>\\n\\t<thead><tr>\\n\\t\\t<th>Name</th>\\n\\t\\t<th>Type</th>\\n\\t\\t<th>Description</th>\\n\\t</tr></thead>\\n\\t<tbody>\\n\\t\\t<tr><td><code>systemToken</code></td><td>String</td><td>Your system's public Id</td></tr>\\n\\t\\t<tr><td><code>secretKey</code></td><td>String</td><td>Secret key</td></tr>\\n\\t\\t<tr><td><code>apiServer</code></td><td>String</td><td>(optional) API Server URI</td></tr>\\n\\t</tbody>\\n</table>\\n    </div>\\n    <div role=\\\"tabpanel\\\" class=\\\"tab-pane\\\" id=\\\"python\\\">\\n    <table>\\n\\t<caption><code>Rublon2Factor</code> class constructor arguments</caption>\\n\\t<thead><tr>\\n\\t\\t<th>Name</th>\\n\\t\\t<th>Type</th>\\n\\t\\t<th>Description</th>\\n\\t</tr></thead>\\n\\t<tbody>\\n\\t\\t<tr><td><code>system_token</code></td><td>str</td><td>Your system's public Id</td></tr>\\n\\t\\t<tr><td><code>secret_key</code></td><td>str</td><td>Secret key</td></tr>\\n\\t\\t<tr><td><code>api_server</code></td><td>str</td><td>(optional) API Server URI</td></tr>\\n\\t</tbody>\\n</table>\\n    </div>\\n  </div>\\n\\n</div>\\n<style>\\n.langnav > li > a {\\n    padding: 3px 15px;\\n}\\ncaption{\\nmargin:10px;\\n}\\n</style>\"\n}\n[/block]\nExamples of the library's initialization: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?\\nrequire_once \\\"libs/Rublon/Rublon2Factor.php\\\";\\n\\n$rublon = new Rublon2Factor(\\\"your_system_token\\\", \\\"your_access_key\\\");\\n\",\n      \"language\": \"php\",\n      \"name\": \"PHP\"\n    },\n    {\n      \"code\": \"using RublonSDK.TwoFactor;\\n\\n...\\n\\nRublon2Factor rublon = new Rublon2Factor(\\\"your_system_token\\\", \\\"your_access_key\\\");\",\n      \"language\": \"csharp\",\n      \"name\": \".NET\"\n    },\n    {\n      \"code\": \"import com.rublon.sdk.twofactor.Rublon2Factor;\\n\\n...\\n    \\nRublon2Factor rublon = new Rublon2Factor(\\\"your_system_token\\\", \\\"your_access_key\\\");\",\n      \"language\": \"java\",\n      \"name\": \"Java\"\n    },\n    {\n      \"code\": \"import Rublon2Factor\\n\\nrublon = Rublon2Factor(\\\"your_system_token\\\", \\\"your_access_key\\\")\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"sdk-library-initialization","type":"basic","title":"Library initialization"}

Library initialization


To initialize the library you need to instantiate a Rublon2Factor class object. Its constructor takes three arguments. [block:html] { "html": "<div>\n\n <!-- Nav tabs -->\n <ul class=\"nav nav-tabs langnav\" role=\"tablist\">\n <li role=\"presentation\" class=\"active\"><a href=\"#php\" aria-controls=\"php\" role=\"tab\" data-toggle=\"tab\">PHP</a></li>\n <li role=\"presentation\"><a href=\"#net\" aria-controls=\"net\" role=\"tab\" data-toggle=\"tab\">.NET</a></li>\n <li role=\"presentation\"><a href=\"#java\" aria-controls=\"java\" role=\"tab\" data-toggle=\"tab\">Java</a></li>\n <li role=\"presentation\"><a href=\"#python\" aria-controls=\"python\" role=\"tab\" data-toggle=\"tab\">Python</a></li>\n </ul>\n\n <!-- Tab panes -->\n <div class=\"tab-content\">\n <div role=\"tabpanel\" class=\"tab-pane active\" id=\"php\">\n<table>\n\t<caption><code>Rublon2Factor</code> class constructor arguments</caption>\n\t<thead><tr>\n\t\t<th>Name</th>\n\t\t<th>Type</th>\n\t\t<th>Description</th>\n\t</tr></thead>\n\t<tbody>\n\t\t<tr><td><code>$systemToken</code></td><td>string</td><td>Your system's public Id</td></tr>\n\t\t<tr><td><code>$secretKey</code></td><td>string</td><td>Secret key</td></tr>\n\t\t<tr><td><code>$apiServer</code></td><td>string</td><td>(optional) API Server URI</td></tr>\n\t</tbody>\n</table> \n </div>\n <div role=\"tabpanel\" class=\"tab-pane\" id=\"net\">\n<table>\n\t<caption><code>Rublon2Factor</code> class constructor arguments</caption>\n\t<thead><tr>\n\t\t<th>Name</th>\n\t\t<th>Type</th>\n\t\t<th>Description</th>\n\t</tr></thead>\n\t<tbody>\n\t\t<tr><td><code>systemToken</code></td><td>string</td><td>Your system's public Id</td></tr>\n\t\t<tr><td><code>secretKey</code></td><td>string</td><td>Secret key</td></tr>\n\t\t<tr><td><code>apiServer</code></td><td>string</td><td>(optional) API Server URI</td></tr>\n\t</tbody>\n</table> \n </div>\n <div role=\"tabpanel\" class=\"tab-pane\" id=\"java\">\n <table>\n\t<caption><code>Rublon2Factor</code> class constructor arguments</caption>\n\t<thead><tr>\n\t\t<th>Name</th>\n\t\t<th>Type</th>\n\t\t<th>Description</th>\n\t</tr></thead>\n\t<tbody>\n\t\t<tr><td><code>systemToken</code></td><td>String</td><td>Your system's public Id</td></tr>\n\t\t<tr><td><code>secretKey</code></td><td>String</td><td>Secret key</td></tr>\n\t\t<tr><td><code>apiServer</code></td><td>String</td><td>(optional) API Server URI</td></tr>\n\t</tbody>\n</table>\n </div>\n <div role=\"tabpanel\" class=\"tab-pane\" id=\"python\">\n <table>\n\t<caption><code>Rublon2Factor</code> class constructor arguments</caption>\n\t<thead><tr>\n\t\t<th>Name</th>\n\t\t<th>Type</th>\n\t\t<th>Description</th>\n\t</tr></thead>\n\t<tbody>\n\t\t<tr><td><code>system_token</code></td><td>str</td><td>Your system's public Id</td></tr>\n\t\t<tr><td><code>secret_key</code></td><td>str</td><td>Secret key</td></tr>\n\t\t<tr><td><code>api_server</code></td><td>str</td><td>(optional) API Server URI</td></tr>\n\t</tbody>\n</table>\n </div>\n </div>\n\n</div>\n<style>\n.langnav > li > a {\n padding: 3px 15px;\n}\ncaption{\nmargin:10px;\n}\n</style>" } [/block] Examples of the library's initialization: [block:code] { "codes": [ { "code": "<?\nrequire_once \"libs/Rublon/Rublon2Factor.php\";\n\n$rublon = new Rublon2Factor(\"your_system_token\", \"your_access_key\");\n", "language": "php", "name": "PHP" }, { "code": "using RublonSDK.TwoFactor;\n\n...\n\nRublon2Factor rublon = new Rublon2Factor(\"your_system_token\", \"your_access_key\");", "language": "csharp", "name": ".NET" }, { "code": "import com.rublon.sdk.twofactor.Rublon2Factor;\n\n...\n \nRublon2Factor rublon = new Rublon2Factor(\"your_system_token\", \"your_access_key\");", "language": "java", "name": "Java" }, { "code": "import Rublon2Factor\n\nrublon = Rublon2Factor(\"your_system_token\", \"your_access_key\")", "language": "python" } ] } [/block]