{"id":1680,"date":"2020-11-19T14:07:55","date_gmt":"2020-11-19T14:07:55","guid":{"rendered":"https:\/\/demo.securemetric.com\/docs\/?page_id=1680"},"modified":"2022-07-05T10:11:02","modified_gmt":"2022-07-05T18:11:02","slug":"update-token-status-api","status":"publish","type":"page","link":"https:\/\/console.centagatecloud.com\/docs\/?page_id=1680","title":{"rendered":"Update Token Status API"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1680\" class=\"elementor elementor-1680\">\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-6e371f9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6e371f9\" 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-664257c\" data-id=\"664257c\" 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-02d7861 elementor-widget elementor-widget-spacer\" data-id=\"02d7861\" 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-09d11b9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"09d11b9\" 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-8bf89c8\" data-id=\"8bf89c8\" 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-4164c38 elementor-widget elementor-widget-heading\" data-id=\"4164c38\" 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\">Update Token Status 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-ebbbbad elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ebbbbad\" 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-8ffe2f4\" data-id=\"8ffe2f4\" 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-0ce93cd elementor-widget elementor-widget-text-editor\" data-id=\"0ce93cd\" 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 update the token status.<\/p><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-e5be5a6 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e5be5a6\" 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-f8ffca1\" data-id=\"f8ffca1\" 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-685bd4e elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"685bd4e\" 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-okaidia' data-show-toolbar='yes'><code class='language-http'>PUT \/CentagateWS\/webresources\/token\/update\/token\/status\/{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-4972988 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4972988\" 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-3167068\" data-id=\"3167068\" 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-48a6006 elementor-widget elementor-widget-heading\" data-id=\"48a6006\" 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-32edb85 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"32edb85\" 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-6e3c4c9\" data-id=\"6e3c4c9\" 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-c5ae213 elementor-widget elementor-widget-htmega-datatable-addons\" data-id=\"c5ae213\" 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-979cb27'>No<\/th><th class='elementor-repeater-item-54e6000'>Parameters<\/th><th class='elementor-repeater-item-bdb454f'>Occurrence<\/th><th class='elementor-repeater-item-f9418a2'>Descriptions<\/th>                        <\/tr>\r\n                    <\/thead>\r\n                                <tbody>\r\n                                            <tr>\r\n                            <td class=\"elementor-repeater-item-b53acef\" >1<\/td><td class=\"elementor-repeater-item-e67298c\" >username<\/td><td class=\"elementor-repeater-item-08bcf0b\" >Required<\/td><td class=\"elementor-repeater-item-5d78996\" >The user's username<\/td>                        <\/tr>\r\n                                            <tr>\r\n                            <td class=\"elementor-repeater-item-5ec4c8b\" >2<\/td><td class=\"elementor-repeater-item-6e6c52e\" >type<\/td><td class=\"elementor-repeater-item-857f1e8\" >Required<\/td><td class=\"elementor-repeater-item-9f5dad3\" >Type of token is 1=Mobile Token, 2=SMS Token, 3=Challenge Question Token and 4=PKI Token<\/td>                        <\/tr>\r\n                                            <tr>\r\n                            <td class=\"elementor-repeater-item-ad7df8a\" >3<\/td><td class=\"elementor-repeater-item-1074c67\" >status<\/td><td class=\"elementor-repeater-item-76b4e70\" >Required<\/td><td class=\"elementor-repeater-item-589ba0c\" >Token Status is 1=Pending, 2=Valid,  3=Temp Deactivate and 4=Deactivate<\/td>                        <\/tr>\r\n                                            <tr>\r\n                            <td class=\"elementor-repeater-item-eb0b6b5\" >4<\/td><td class=\"elementor-repeater-item-22de422\" >cenToken<\/td><td class=\"elementor-repeater-item-e53c4f4\" >Required<\/td><td class=\"elementor-repeater-item-a86a262\" >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-5ffedd8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5ffedd8\" 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-0684f48\" data-id=\"0684f48\" 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-ab57a1e elementor-widget elementor-widget-spacer\" data-id=\"ab57a1e\" 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-42b0356 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"42b0356\" 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-25eae27\" data-id=\"25eae27\" 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-856d21c elementor-widget elementor-widget-heading\" data-id=\"856d21c\" 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-17996b5 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"17996b5\" 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-efbff58\" data-id=\"efbff58\" 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-e364be3 elementor-widget elementor-widget-text-editor\" data-id=\"e364be3\" 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-cfdc685 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"cfdc685\" 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-cfdc2cc\" data-id=\"cfdc2cc\" 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-2fef365 elementor-tabs-view-horizontal elementor-widget elementor-widget-tabs\" data-id=\"2fef365\" 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-5021\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"true\" data-tab=\"1\" role=\"tab\" tabindex=\"0\" aria-controls=\"elementor-tab-content-5021\" aria-expanded=\"false\"><a href=\"\">Java<\/a><\/div>\n\t\t\t\t\t\t\t\t\t<div id=\"elementor-tab-title-5022\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"false\" data-tab=\"2\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-5022\" aria-expanded=\"false\"><a href=\"\">Node Js<\/a><\/div>\n\t\t\t\t\t\t\t\t\t<div id=\"elementor-tab-title-5023\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"false\" data-tab=\"3\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-5023\" aria-expanded=\"false\"><a href=\"\">PHP<\/a><\/div>\n\t\t\t\t\t\t\t\t\t<div id=\"elementor-tab-title-5024\" class=\"elementor-tab-title elementor-tab-desktop-title\" aria-selected=\"false\" data-tab=\"4\" role=\"tab\" tabindex=\"-1\" aria-controls=\"elementor-tab-content-5024\" 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-5021\" aria-expanded=\"false\">Java<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-5021\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"1\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-5021\" tabindex=\"0\" hidden=\"false\"><p>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3250\" class=\"elementor elementor-3250\">\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-d09354b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d09354b\" 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-2c7081e\" data-id=\"2c7081e\" 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-edb70a2 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"edb70a2\" 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\t\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;type&quot;, &quot;type&quot;);\r\n\tmap.put(&quot;status&quot;, &quot;status&quot;);\r\n\tmap.put(&quot;cenToken&quot;, cenToken);  \r\n\r\n\tClientResponse response = service.path(&quot;token&quot;).path(&quot;update&quot;).path(&quot;token&quot;).path(&quot;status&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-5022\" aria-expanded=\"false\">Node Js<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-5022\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"2\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-5022\" tabindex=\"0\" hidden=\"hidden\"><p>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3252\" class=\"elementor elementor-3252\">\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-822be14 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"822be14\" 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-b836027\" data-id=\"b836027\" 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-241d143 elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"241d143\" 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 type = &quot;&lt;type&gt;&quot;;\r\nvar status = &quot;&lt;status&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\ttype: type,\r\n\tstatus: status,\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\/update\/token\/status\/'+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-5023\" aria-expanded=\"false\">PHP<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-5023\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"3\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-5023\" tabindex=\"0\" hidden=\"hidden\"><p>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3254\" class=\"elementor elementor-3254\">\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-fb1fa9f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"fb1fa9f\" 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-79a1e58\" data-id=\"79a1e58\" 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-768e0de elementor-widget elementor-widget-code-block-for-elementor\" data-id=\"768e0de\" 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\/update\/token\/status\/'.$adminUsername;\r\n    \r\n    $ch = curl_init($url);\r\n    \r\n    $username = &quot;&lt;username&gt;&quot;;\r\n    $type = &quot;&lt;type&gt;&quot;;\r\n    $status = &quot;&lt;status&gt;&quot;;\r\n    \r\n    $secretCode = &quot;&lt;secretCode&gt;&quot;;\r\n    $authToken = &quot;&lt;authToken&gt;&quot;;\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'type'=&gt; $type,\r\n    \t'status'=&gt; $status,\r\n    \t'cenToken' =&gt; $cenToken\r\n    );\r\n    \r\n    $jsonDataEncoded = json_encode($jsonData);\r\n    \r\n    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');\r\n    curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);\r\n    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application\/json'));\r\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\r\n    \r\n    $result = curl_exec($ch);\r\n    \r\n    \r\n    $obj = json_decode($result); \r\n    if ($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\n    else {\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\n    curl_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-5024\" aria-expanded=\"false\">Error Code<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-5024\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"4\" role=\"tabpanel\" aria-labelledby=\"elementor-tab-title-5024\" tabindex=\"0\" hidden=\"hidden\"><p>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"4102\" class=\"elementor elementor-4102\">\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-e304b6d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e304b6d\" 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-457162f\" data-id=\"457162f\" 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-3e0e173 elementor-widget elementor-widget-Table\" data-id=\"3e0e173\" 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-697448a\" >10001<\/td><td   class=\"elementor-repeater-item-4ceaa8f\" >Permission not allowed<\/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\" >10011<\/td><td   class=\"elementor-repeater-item-e7fcefe\" >Crypto error<\/td><\/tr><tr><td   class=\"elementor-repeater-item-b5f2d78\" >22002<\/td><td   class=\"elementor-repeater-item-86d1d3a\" >User not found<\/td><\/tr><tr><td   class=\"elementor-repeater-item-9f5603c\" >29001<\/td><td   class=\"elementor-repeater-item-0eebc35\" >Token not found<\/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>Update Token Status API Call this function to update the token status. Below is the URL to access the API functions: PUT \/CentagateWS\/webresources\/token\/update\/token\/status\/{admin_username} Parameters No Parameters Occurrence Descriptions 1 username Required The user&#8217;s username 2 type Required Type of token is 1=Mobile Token, 2=SMS Token, 3=Challenge Question Token and 4=PKI Token 3 status Required Token [&hellip;]<\/p>\n<a class=\"read-more-tag\" \n         href=\"https:\/\/console.centagatecloud.com\/docs\/?page_id=1680\">&nbsp;Read More<\/a>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=\/wp\/v2\/pages\/1680"}],"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=1680"}],"version-history":[{"count":26,"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=\/wp\/v2\/pages\/1680\/revisions"}],"predecessor-version":[{"id":6144,"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=\/wp\/v2\/pages\/1680\/revisions\/6144"}],"wp:attachment":[{"href":"https:\/\/console.centagatecloud.com\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}