{"id":1722,"date":"2024-11-19T20:44:38","date_gmt":"2024-11-19T12:44:38","guid":{"rendered":"https:\/\/www.tonghin.com.my\/blog\/?p=1722"},"modified":"2024-11-19T20:44:40","modified_gmt":"2024-11-19T12:44:40","slug":"add-claims-refresh-token-and-authorize","status":"publish","type":"post","link":"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/","title":{"rendered":"Add claims, refresh token and authorize"},"content":{"rendered":"\n<p>Fifth week\u00a0as an intern in Tong Hin. After some simple implementation on last Friday to test out with the bare minimum requirement, the week start with implementing claim and necessary column for the Web project. Claiming additional user details as claims in a token helps streamline processing. It also enhance security as claiming unique value in the token.<\/p>\n\n\n\n<p>Some continuous testing on access token was done by Monday and it works through. Continuing with refresh token on Tuesday, it is a bit different than access token. The concept of refresh token is to generate a new access token when the access token is expired as the refresh token is set to be live longer than access token. After some research and coding, it worked after testing out with access token.<\/p>\n\n\n\n<p>Continuing with update with authorize, I need to do authorization for the update command by sending the access token together with the detail to change . If the detail of the token is not the same as the registered detail of the database, it will be denied unless it is a privileged account. I did not think of sending the access token in the body at first and after some help from Mr. Peter, the task is done.<\/p>\n\n\n\n<p>After an amount of time of trying out new concept and try to implementing new idea in the sandbox, Mr. Peter asked me to implement in the main project instead of sandbox. Everything work through except for 1 or 2 test and will continue it on next week. It is happy to see progression.<\/p>\n\n\n\n<p>In summary, I have done different learning and implementing on new concept for me this week. For the past 2 week, I have been doing with Core Identity, JWT token and claims. I got a better understanding of every part of the code. It is indeed happy to keep on learning and doing as after doing 1 task, there will be another task to continue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fifth week\u00a0as an intern in Tong Hin. After some simple implementation on last Friday to test out with the bare minimum requirement, the week start with implementing claim and necessary column for the Web project. Claiming additional user details as claims in a token helps streamline processing. It also enhance security as claiming unique value &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Add claims, refresh token and authorize&#8221;<\/span><\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Add claims, refresh token and authorize | Tong Hin&#039;s Blog<\/title>\n<meta name=\"description\" content=\"Fifth week\u00a0as an intern in Tong Hin. In summary, I have done different learning and implementing on new concept for me this week.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add claims, refresh token and authorize | Tong Hin&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"Fifth week\u00a0as an intern in Tong Hin. In summary, I have done different learning and implementing on new concept for me this week.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/\" \/>\n<meta property=\"og:site_name\" content=\"Tong Hin&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-19T12:44:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-19T12:44:40+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"2 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\",\"name\":\"TONG HIN MACHINERY\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"sameAs\":[\"https:\/\/www.youtube.com\/channel\/UC60EoxJMNbu8mV0LuEGfrBg\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/wp-content\/uploads\/2020\/10\/web_logo_180_180.jpg\",\"width\":180,\"height\":180,\"caption\":\"TONG HIN MACHINERY\"},\"image\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Tong Hin&#039;s Blog\",\"description\":\"Sharing About Technology\",\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.tonghin.com.my\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/#webpage\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/\",\"name\":\"Add claims, refresh token and authorize | Tong Hin&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\"},\"datePublished\":\"2024-11-19T12:44:38+00:00\",\"dateModified\":\"2024-11-19T12:44:40+00:00\",\"description\":\"Fifth week\\u00a0as an intern in Tong Hin. In summary, I have done different learning and implementing on new concept for me this week.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/\",\"name\":\"Add claims, refresh token and authorize\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/913b5bfba79926673180dd4f175140f9\"},\"headline\":\"Add claims, refresh token and authorize\",\"datePublished\":\"2024-11-19T12:44:38+00:00\",\"dateModified\":\"2024-11-19T12:44:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/11\/19\/add-claims-refresh-token-and-authorize\/#webpage\"},\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"articleSection\":\"Experiential\",\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/913b5bfba79926673180dd4f175140f9\",\"name\":\"Lim Jun Hau\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0f29cea137e12dc2f5d6bf8daba219c6?s=96&d=mm&r=g\",\"caption\":\"Lim Jun Hau\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1722"}],"collection":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/comments?post=1722"}],"version-history":[{"count":3,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1722\/revisions"}],"predecessor-version":[{"id":1743,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1722\/revisions\/1743"}],"wp:attachment":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/media?parent=1722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/categories?post=1722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/tags?post=1722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}