{"id":766,"date":"2022-10-23T22:01:15","date_gmt":"2022-10-23T20:01:15","guid":{"rendered":"https:\/\/www.voldrich.net\/?p=766"},"modified":"2022-10-23T22:02:43","modified_gmt":"2022-10-23T20:02:43","slug":"postman-jwt-token-generator","status":"publish","type":"post","link":"https:\/\/www.voldrich.net\/index.php\/2022\/10\/23\/postman-jwt-token-generator\/","title":{"rendered":"Postman JWT token generator"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>Use script below to generate and set JWT token with HS256 signature and store it in \u201cjwt\u201d environment variable. To use it edit SECRET_KEY and set headers as you need. Then paste the script into pre-request script in postman HTTP request definition. Use the environment variable {{jwt}} in your authentication of type Bearer to use it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"322\" src=\"https:\/\/www.voldrich.net\/wp-content\/uploads\/2022\/10\/image-1024x322.png\" alt=\"\" class=\"wp-image-769\" srcset=\"https:\/\/www.voldrich.net\/wp-content\/uploads\/2022\/10\/image-1024x322.png 1024w, https:\/\/www.voldrich.net\/wp-content\/uploads\/2022\/10\/image-300x94.png 300w, https:\/\/www.voldrich.net\/wp-content\/uploads\/2022\/10\/image-768x241.png 768w, https:\/\/www.voldrich.net\/wp-content\/uploads\/2022\/10\/image-1536x483.png 1536w, https:\/\/www.voldrich.net\/wp-content\/uploads\/2022\/10\/image-1200x377.png 1200w, https:\/\/www.voldrich.net\/wp-content\/uploads\/2022\/10\/image.png 1896w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can check the result token in <a href=\"https:\/\/token.dev\/\">https:\/\/token.dev\/<\/a>. And you can read all about JWT and their signing at <a href=\"https:\/\/auth0.com\/blog\/rs256-vs-hs256-whats-the-difference\/\">https:\/\/auth0.com\/blog\/rs256-vs-hs256-whats-the-difference\/<\/a> .<\/p>\n\n\n\n<p>Code taken\/was derived from&nbsp; <a href=\"https:\/\/hirosht.medium.com\/customized-jwt-encoded-with-hmac-sha256-hs256-267574bd7639\">https:\/\/hirosht.medium.com\/customized-jwt-encoded-with-hmac-sha256-hs256-267574bd7639<\/a>&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/MavoCz\/b4823735423c2ff251fbc46b74b4d5eb.js\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/MavoCz\/b4823735423c2ff251fbc46b74b4d5eb\">Gist<\/a>.<\/noscript><\/div>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Use script below to generate and set JWT token with HS256 signature and store it in \u201cjwt\u201d environment variable. To use it edit SECRET_KEY and set headers as you need. Then paste the script into pre-request script in postman HTTP request definition. Use the environment variable {{jwt}} in your authentication of type Bearer to use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[14,18,17],"class_list":["post-766","post","type-post","status-publish","format-standard","hentry","category-development","tag-javascript","tag-jwt","tag-postman"],"_links":{"self":[{"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/posts\/766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/comments?post=766"}],"version-history":[{"count":4,"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/posts\/766\/revisions"}],"predecessor-version":[{"id":771,"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/posts\/766\/revisions\/771"}],"wp:attachment":[{"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/media?parent=766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/categories?post=766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voldrich.net\/index.php\/wp-json\/wp\/v2\/tags?post=766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}