{"id":1618,"date":"2020-11-19T10:04:55","date_gmt":"2020-11-19T10:04:55","guid":{"rendered":"https:\/\/demo.securemetric.com\/docs\/?page_id=1618"},"modified":"2022-07-05T02:56:23","modified_gmt":"2022-07-05T10:56:23","slug":"token-registration","status":"publish","type":"page","link":"https:\/\/console.centagatecloud.com\/docs\/?page_id=1618","title":{"rendered":"Token Registration API"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1618\" class=\"elementor elementor-1618\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a2c364b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a2c364b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9b354cd\" data-id=\"9b354cd\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-204bbe3 elementor-widget elementor-widget-spacer\" data-id=\"204bbe3\" data-element_type=\"widget\" data-widget_type=\"spacer.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"elementor-spacer\">\n\t\t\t<div class=\"elementor-spacer-inner\"><\/div>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-6423d44 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6423d44\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-45f3728\" data-id=\"45f3728\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1e637a7 elementor-widget elementor-widget-heading\" data-id=\"1e637a7\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Token Registration API<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-54c94bb elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"54c94bb\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0b67339\" data-id=\"0b67339\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-248722f elementor-widget elementor-widget-text-editor\" data-id=\"248722f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p>Call this function to register an active SMS or OTP token.<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-39faf06 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"39faf06\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0489f22\" data-id=\"0489f22\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-412bc2f elementor-widget elementor-widget-text-editor\" data-id=\"412bc2f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p>Below is the URL to access the API functions:<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-280ab8a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"280ab8a\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b8ccbe6\" data-id=\"b8ccbe6\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5452838 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"5452838\" data-element_type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre class='theme-twilight' data-show-toolbar='yes'><code class='language-http'>PUT \/CentagateWS\/webresources\/token\/registerActiveToken\/{admin_username}<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-f61ff5c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f61ff5c\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-aad3efc\" data-id=\"aad3efc\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-67b28c7 elementor-widget elementor-widget-heading\" data-id=\"67b28c7\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Parameters<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-229c0e6 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"229c0e6\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6240f8e\" data-id=\"6240f8e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cccad11 elementor-widget elementor-widget-htmega-datatable-addons\" data-id=\"cccad11\" data-element_type=\"widget\" data-widget_type=\"htmega-datatable-addons.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t        <div class=\"htmega-table-style htmega-table-style-2 htb-table-responsive\">\r\n            <table class=\"htb-table \">\r\n                                    <thead>\r\n                        <tr>\r\n                            <th class='elementor-repeater-item-e220b29'>No<\/th><th class='elementor-repeater-item-02ec9a5'>Parameter<\/th><th class='elementor-repeater-item-a9ed009'>Occurence<\/th><th class='elementor-repeater-item-589a41e'>Description<\/th>                        <\/tr>\r\n                    <\/thead>\r\n                                <tbody>\r\n                                            <tr>\r\n                            <td class=\"elementor-repeater-item-ac115b6\" >1<\/td><td class=\"elementor-repeater-item-170f87f\" >Username<\/td><td class=\"elementor-repeater-item-cfd908e\" >Required<\/td><td class=\"elementor-repeater-item-025821b\" >The User\u2019s Username<\/td>                        <\/tr>\r\n                                            <tr>\r\n                            <td class=\"elementor-repeater-item-921b913\" >2<\/td><td class=\"elementor-repeater-item-1c29df0\" >TokenSn<\/td><td class=\"elementor-repeater-item-ed73ccc\" >Required<\/td><td class=\"elementor-repeater-item-bfdca49\" >The Mobile Number or Hardware Token Serial Number. This Mandatory For Token Type SMS and OTP.  (For OTP make sure the Token is not bound with another user and token status is must be deactivate status)<\/td>                        <\/tr>\r\n                                            <tr>\r\n                            <td class=\"elementor-repeater-item-396716c\" >3<\/td><td class=\"elementor-repeater-item-47ae7e2\" >TokenType<\/td><td class=\"elementor-repeater-item-998440d\" >Required<\/td><td class=\"elementor-repeater-item-c963f42\" >The Token Type: SMS = 1 and OTP\u200b = 2<\/td>                        <\/tr>\r\n                                            <tr>\r\n                            <td class=\"elementor-repeater-item-a100bb5\" >4<\/td><td class=\"elementor-repeater-item-9ca3b63\" >CenToken<\/td><td class=\"elementor-repeater-item-2c68bd2\" >Required<\/td><td class=\"elementor-repeater-item-15a3814\" >The Hmac Value Calculated Using SHA256 With SecretCode As Key And Plain Text From Admin Username + AuthToken<\/td>                        <\/tr>\r\n                                    <\/tbody>\r\n            <\/table>\r\n        <\/div>\r\n        \t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-30b62f4 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"30b62f4\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-81f3b54\" data-id=\"81f3b54\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d26ff4c elementor-widget elementor-widget-spacer\" data-id=\"d26ff4c\" data-element_type=\"widget\" data-widget_type=\"spacer.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"elementor-spacer\">\n\t\t\t<div class=\"elementor-spacer-inner\"><\/div>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7c74d3a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7c74d3a\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-51da82a\" data-id=\"51da82a\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d127c7f elementor-widget elementor-widget-heading\" data-id=\"d127c7f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-xl\">Sample Code<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-90b5970 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"90b5970\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f677f74\" data-id=\"f677f74\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-eaeb391 elementor-widget elementor-widget-text-editor\" data-id=\"eaeb391\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p>As in below there are some examples of source code of access the API functions:<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-0af7464 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"0af7464\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-fd319ad\" data-id=\"fd319ad\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-c44d4a6 elementor-tabs-view-horizontal elementor-widget elementor-widget-tabs\" data-id=\"c44d4a6\" data-element_type=\"widget\" data-widget_type=\"tabs.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"elementor-tabs\">\n\t\t\t<div class=\"elementor-tabs-wrapper\" role=\"tablist\" >\n\t\t\t\t\t\t\t\t\t<div id=\"elementor-tab-title-2051\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"true\" data-tab=\"1\" role=\"tab\" tabindex=\"0\" aria-controls=\"elementor-tab-content-2051\" aria-expanded=\"false\"><a href=\"\">Java<\/a><\/div>\n\t\t\t\t\t\t\t\t\t<div id=\"elementor-tab-title-2052\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"false\" data-tab=\"2\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-2052\" aria-expanded=\"false\"><a href=\"\">Node Js<\/a><\/div>\n\t\t\t\t\t\t\t\t\t<div id=\"elementor-tab-title-2053\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"false\" data-tab=\"3\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-2053\" aria-expanded=\"false\"><a href=\"\">PHP<\/a><\/div>\n\t\t\t\t\t\t\t\t\t<div id=\"elementor-tab-title-2054\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"false\" data-tab=\"4\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-2054\" aria-expanded=\"false\"><a href=\"\">Error Code<\/a><\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t<div class=\"elementor-tabs-content-wrapper\" role=\"tablist\" aria-orientation=\"vertical\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-tab-title elementor-tab-mobile-title\" aria-selected=\"true\" data-tab=\"1\" role=\"tab\" tabindex=\"0\" aria-controls=\"elementor-tab-content-2051\" aria-expanded=\"false\">Java<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-2051\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"1\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-2051\" tabindex=\"0\" hidden=\"false\"><p>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3143\" class=\"elementor elementor-3143\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d66f117 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d66f117\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7c2b0b5\" data-id=\"7c2b0b5\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-78bfeda elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"78bfeda\" data-element_type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre class='line-numbers theme-tomorrow-night' data-show-toolbar='yes'><code class='language-java'>public static void main(String[] args) {\r\n\r\n\tClientConfig config = new DefaultClientConfig ();\r\n\tClient client = Client.create ( config );\r\n\tWebResource service = client.resource (&quot;https:\/\/&lt;domain_name&gt;\/CentagateWS\/webresources&quot;);\r\n\t\t\t\r\n\tGson gson = new Gson();\r\n\r\n\tString authToken = &quot;{authToken}&quot;\r\n\tString adminUsername = &quot;{adminUsername}&quot;;\r\n\tString secretCode &quot;{secretCode}&quot;;\r\n\tString cenToken = convertHmacSha256(secretCode, adminUsername + authToken);\r\n\r\n\tHashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();\r\n\tmap.put(&quot;username&quot;, &quot;username&quot;);\r\n\tmap.put(&quot;tokenSn&quot;, &quot;tokenSn&quot;);\r\n\tmap.put(&quot;tokenType&quot;, &quot;tokenType&quot;);\r\n\tmap.put(&quot;cenToken&quot;, cenToken);  \r\n\r\n\tClientResponse response = service.path(&quot;token&quot;).path(&quot;registerActiveToken&quot;).path(adminUsername).accept(MediaType.APPLICATION_JSON).put(ClientResponse.class, gson.toJson(map));\r\n\t\t\t\t\r\n\tString retJson = response.getEntity(String.class);\r\n\r\n\tHashMap&lt;String, Object&gt; returnData = (HashMap&lt;String, Object&gt;) gson.fromJson(retJson, HashMap.class);\r\n\r\n\tString code = returnData.get(&quot;code&quot;).toString();\r\n\tString message = returnData.get(&quot;message&quot;).toString();\r\n\tString object = returnData.get(&quot;object&quot;).toString();\r\n}\r\n\r\npublic static String convertHmacSha256(String secretKey, String params) throws NoSuchAlgorithmException, \r\n            InvalidKeyException,IllegalStateException, SignatureException, NoSuchProviderException, Exception\r\n{\r\n\ttry\r\n\t{\r\n\t\tfinal SecretKeySpec secret_key = new SecretKeySpec ( StringUtils.getBytesUtf8 ( secretKey ) , &quot;HmacSHA256&quot; );\r\n\t\tfinal Mac mac = Mac.getInstance ( &quot;HmacSHA256&quot; );\r\n\t\tmac.init ( secret_key );\r\n\t\tfinal byte[] bytes = mac.doFinal ( StringUtils.getBytesUtf8 ( params ) );\r\n\t\treturn Hex.encodeHexString ( bytes );\r\n\t}\r\n\tcatch ( NoSuchAlgorithmException e )\r\n\t{\r\n\t\tthrow new NoSuchAlgorithmException ( e );\r\n\t}\r\n\tcatch ( InvalidKeyException e )\r\n\t{\r\n\t\tthrow new InvalidKeyException ( e );\r\n\t}\r\n\tcatch ( IllegalStateException e )\r\n\t{\r\n\t\tthrow new IllegalStateException ( e );\r\n\t}\r\n\tcatch ( Exception e )\r\n\t{\r\n\t\tthrow new Exception ( e );\r\n\t}\r\n}<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/p><\/div>\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-tab-title elementor-tab-mobile-title\" aria-selected=\"false\" data-tab=\"2\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-2052\" aria-expanded=\"false\">Node Js<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-2052\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"2\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-2052\" tabindex=\"0\" hidden=\"hidden\"><p>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3148\" class=\"elementor elementor-3148\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-849992f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"849992f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9462697\" data-id=\"9462697\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e001bde elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"e001bde\" data-element_type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre class='line-numbers theme-tomorrow-night' data-show-toolbar='yes'><code class='language-javascript'>const https = require('https')\r\n\r\nvar crypto = require('crypto');\r\nvar username = &quot;&lt;username&gt;&quot;;\r\nvar tokenSn = &quot;&lt;tokenSn&gt;&quot;;\r\nvar tokenType = &quot;&lt;tokenType&gt;&quot;;\r\n\r\nvar adminUsername = &quot;&lt;adminUsername&gt;&quot;;\r\nvar authToken = &quot;&lt;authToken&gt;&quot;;\r\nvar secretCode = &quot;&lt;secretCode&gt;&quot;;\r\n  \r\nvar cenTokenText = adminUsername + authToken;\r\nvar hash, cenToken;\r\n\r\n\/* generate cenToken value*\/\r\ncenToken = crypto.createHmac(sha256, secretCode);    \r\ncenToken.write(cenTokenText);\r\ncenToken.end();      \r\nhash = cenToken.read().toString('hex');    \r\n\r\nconst data = JSON.stringify({\r\n\tusername: username,\r\n\ttokenSn: tokenSn,\r\n\ttokenType: tokenType,\r\n\tcenToken: hash\r\n})\r\n\r\nconst options = {\r\n\thostname: &quot;&lt;domain_name&gt;&quot;,\r\n\tport: 443,\r\n\tpath:'\/CentagateWS\/webresources\/token\/registerActiveToken\/&quot;+adminUsername)',\r\n\tmethod: 'PUT',\r\n\theaders: {\r\n\t\t'Accept': 'application\/json',\r\n\t\t'Content-Type': 'application\/json',\r\n\t}\r\n}\r\n\r\nconst req = https.request(options, res =&gt;{\r\n\tconsole.log(`HTTP Status Code: ${res.statusCode}`)\r\n\tvar body = '';\r\n\tres.on('data', function(d){\r\n\t\t\r\n\tbody += d;\r\n\tvar parsed = JSON.parse(body);\r\n\t\r\n\tif (parsed.code == 0){\r\n\t   console.log('Authentication Succeed');\r\n\t   console.log('Response:');\r\n\t   console.log(body);\r\n\t}\r\n\telse {\r\n\t  console.log('Authentication Fail, ' +'Message:' + parsed.message);\r\n\t  console.log('Code:' + parsed.code); \r\n\t}\r\n\t\t\r\n\t})\r\n})\r\n\r\nreq.on('ERROR', error =&gt; {\r\n\tconsole.error(error)\r\n})\r\n\r\nreq.write(data)\r\nreq.end()<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/p><\/div>\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-tab-title elementor-tab-mobile-title\" aria-selected=\"false\" data-tab=\"3\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-2053\" aria-expanded=\"false\">PHP<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-2053\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"3\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-2053\" tabindex=\"0\" hidden=\"hidden\"><p>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3152\" class=\"elementor elementor-3152\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e6fc2dc elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e6fc2dc\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-dc22d56\" data-id=\"dc22d56\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-fcc2718 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"fcc2718\" data-element_type=\"widget\" data-widget_type=\"code-block-for-elementor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre class='line-numbers theme-tomorrow-night' data-show-toolbar='yes'><code class='language-php'>&lt;?php\r\n$adminUsername = &quot;&lt;adminUsername&gt;&quot;;\r\n$url = 'https:\/\/&lt;domain_name&gt;\/CentagateWS\/webresources\/token\/registerActiveToken\/'.$adminUsername;\r\n\r\n$ch = curl_init($url);\r\n\r\n$secretCode = &quot;&lt;secretCode&gt;&quot;;\r\n$authToken = &quot;&lt;authToken&gt;&quot;;\r\n\r\n$username = &quot;&lt;username&gt;&quot;;\r\n$tokenSn = &quot;&lt;tokenSn&gt;&quot;;\r\n$tokenType = &quot;&lt;tokenType&gt;&quot;;\r\n\r\n$cenToken_text = $adminUsername.$authToken;\r\n$cenToken = hash_hmac('sha256', $cenToken_text, $secretCode); \/\/ calculate cenToken value\r\n\r\n$jsonData = array (\r\n\t'username'=&gt; $username,\r\n\t'tokenSn'=&gt; $tokenSn,\r\n\t'tokenType'=&gt; $tokenType,\r\n\t'cenToken' =&gt; $cenToken\r\n);\r\n\r\n$jsonDataEncoded = json_encode($jsonData);\r\n\r\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');\r\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);\r\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application\/json'));\r\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r\n\r\n$result = curl_exec($ch);\r\n\r\n\r\n$obj = json_decode($result); \r\nif ($obj-&gt;{'code'} != 0){\r\n\tprint &quot;Authentication fail&quot;;\r\n\tprint &quot;Message: &quot;.$obj-&gt;{'message'}; \r\n\techo &quot; &lt;br&gt;&quot;; \r\n\tprint &quot;Code: &quot;.$obj-&gt;{'code'};\r\n}\r\nelse {\r\n\tprint &quot;Authentication succeed&quot;;\r\n\techo &quot; &lt;br&gt;&quot;; \r\n\tprint &quot;Message: &quot;.$obj-&gt;{'message'}; \r\n\techo &quot; &lt;br&gt;&quot;; \r\n\tprint &quot;Code: &quot;.$obj-&gt;{'code'}; \r\n\techo &quot; &lt;br&gt;&quot;; \r\n\tprint &quot;Result:&quot; ;\r\n\techo &quot; &lt;br&gt;&quot;; \r\n\tprint $result;\r\n}\r\n\r\ncurl_close($ch);\r\n\r\n?&gt;<\/code><\/pre>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/p><\/div>\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-tab-title elementor-tab-mobile-title\" aria-selected=\"false\" data-tab=\"4\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-2054\" aria-expanded=\"false\">Error Code<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-2054\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"4\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-2054\" tabindex=\"0\" hidden=\"hidden\"><p>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"4068\" class=\"elementor elementor-4068\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5b014dd elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5b014dd\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9a4416e\" data-id=\"9a4416e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5342132 elementor-widget elementor-widget-Table\" data-id=\"5342132\" data-element_type=\"widget\" data-widget_type=\"Table.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<table class=\"tafe-table\">\n\t\t\t<thead  class=\"tafe-table-header\">\n\t\t\t\t<tr>\n\t\t\t\t\t<th class=\"elementor-inline-editing elementor-repeater-item-709daa8\"   >Return Code<\/th><th class=\"elementor-inline-editing elementor-repeater-item-ff318f2\"   >Details<\/th>\t\t\t\t<\/tr>\n\t\t\t<\/thead>\n\t\t\t<tbody class=\"tafe-table-body\">\n\t\t\t\t<tr>\n\t\t\t\t\t<td   class=\"elementor-repeater-item-0b74d50\" >0<\/td><td   class=\"elementor-repeater-item-4a03917\" >Success<\/td><\/tr><tr><td   class=\"elementor-repeater-item-5a39c17\" >10002<\/td><td   class=\"elementor-repeater-item-e6d3e52\" >Invalid Input<\/td><\/tr><tr><td   class=\"elementor-repeater-item-00d5337\" >10003<\/td><td   class=\"elementor-repeater-item-614d010\" >DB protection error<\/td><\/tr><tr><td   class=\"elementor-repeater-item-ed5c271\" >10004<\/td><td   class=\"elementor-repeater-item-878f6c1\" >DB error<\/td><\/tr><tr><td   class=\"elementor-repeater-item-91ba6bf\" >22002<\/td><td   class=\"elementor-repeater-item-e7fcefe\" >User not found<\/td><\/tr><tr><td   class=\"elementor-repeater-item-b5f2d78\" >29001<\/td><td   class=\"elementor-repeater-item-86d1d3a\" >Token not found<\/td><\/tr><tr><td   class=\"elementor-repeater-item-2caf6a3\" >29002<\/td><td   class=\"elementor-repeater-item-a4ccdc1\" >Token not active<\/td><\/tr><tr><td   class=\"elementor-repeater-item-8d0fa00\" >29004<\/td><td   class=\"elementor-repeater-item-ad5bcb0\" >Phone number had been used<\/td><\/tr><tr><td   class=\"elementor-repeater-item-b7de332\" >29008<\/td><td   class=\"elementor-repeater-item-51090a9\" >An OTP token already registered to this user<\/td><\/tr><tr><td   class=\"elementor-repeater-item-738df0c\" >29011<\/td><td   class=\"elementor-repeater-item-8817e98\" >Invalid token activation code<\/td><\/tr><tr><td   class=\"elementor-repeater-item-31029b9\" >29017<\/td><td   class=\"elementor-repeater-item-41a515f\" >Invalid token status<\/td><\/tr><tr><td   class=\"elementor-repeater-item-f493d9d\" >6002<\/td><td   class=\"elementor-repeater-item-b0f58c4\" >Token register to user failed<\/td><\/tr><tr><td   class=\"elementor-repeater-item-f9db577\" >6007<\/td><td   class=\"elementor-repeater-item-383012e\" >User is not allowed to bind with CR OTP token<\/td>\t\t\t\t<\/tr>\n\t\t\t<\/tbody>\n\t\t<\/table>\n\t\t\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/p><\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Token Registration API Call this function to register an active SMS or OTP token. Below is the URL to access the API functions: PUT \/CentagateWS\/webresources\/token\/registerActiveToken\/{admin_username} Parameters No Parameter Occurence Description 1 Username Required The User\u2019s Username 2 TokenSn Required The Mobile Number or Hardware Token Serial Number. This Mandatory For Token Type SMS and OTP. [&hellip;]<\/p>\n<a class=\"read-more-tag\" \n         href=\"https:\/\/console.centagatecloud.com\/docs\/?page_id=1618\">&nbsp;Read More<\/a>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=\/wp\/v2\/pages\/1618"}],"collection":[{"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1618"}],"version-history":[{"count":44,"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=\/wp\/v2\/pages\/1618\/revisions"}],"predecessor-version":[{"id":6138,"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=\/wp\/v2\/pages\/1618\/revisions\/6138"}],"wp:attachment":[{"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}