{"id":157,"date":"2021-03-14T14:29:36","date_gmt":"2021-03-14T13:29:36","guid":{"rendered":"https:\/\/www.eversys.cz\/?p=157"},"modified":"2021-03-14T14:29:37","modified_gmt":"2021-03-14T13:29:37","slug":"jak-na-bearer-tokeny-v-curlu","status":"publish","type":"post","link":"https:\/\/www.eversys.cz\/index.php\/2021\/03\/14\/jak-na-bearer-tokeny-v-curlu\/","title":{"rendered":"Jak na Bearer tokeny v cURLu"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\" id=\"b3f4\">Nejd\u0159\u00edve st\u00e1hnout s login\/password a s jq ulo\u017eit<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">TOKEN=$(curl -s -X POST -H 'Accept: application\/json' -H 'Content-Type: application\/json' --data '{\"username\":\"{username}\",\"password\":\"{password}\",\"rememberMe\":false}' https:\/\/{hostname}\/api\/authenticate | jq -r '.id_token')<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"2c66\">P\u0159ed\u00e1n\u00ed Bearer tokenu do Authorization headeru<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"><mark>curl -H 'Accept: application\/json' -H \"Authorization: Bearer ${TOKEN}\" https:\/\/{hostname}\/api\/myresource<\/mark><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nejd\u0159\u00edve st\u00e1hnout s login\/password a s jq ulo\u017eit TOKEN=$(curl -s -X POST -H &#8218;Accept: application\/json&#8216; -H &#8218;Content-Type: application\/json&#8216; &#8211;data &#8218;{&#8222;username&#8220;:&#8220;{username}&#8220;,&#8220;password&#8220;:&#8220;{password}&#8220;,&#8220;rememberMe&#8220;:false}&#8216; https:\/\/{hostname}\/api\/authenticate | jq -r &#8218;.id_token&#8216;) P\u0159ed\u00e1n\u00ed Bearer tokenu do Authorization headeru curl -H &#8218;Accept: application\/json&#8216; -H &#8222;Authorization: Bearer ${TOKEN}&#8220; https:\/\/{hostname}\/api\/myresource<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-157","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.eversys.cz\/index.php\/wp-json\/wp\/v2\/posts\/157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.eversys.cz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.eversys.cz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.eversys.cz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.eversys.cz\/index.php\/wp-json\/wp\/v2\/comments?post=157"}],"version-history":[{"count":0,"href":"https:\/\/www.eversys.cz\/index.php\/wp-json\/wp\/v2\/posts\/157\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.eversys.cz\/index.php\/wp-json\/wp\/v2\/media?parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.eversys.cz\/index.php\/wp-json\/wp\/v2\/categories?post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.eversys.cz\/index.php\/wp-json\/wp\/v2\/tags?post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}