{"id":113,"date":"2024-04-20T18:30:09","date_gmt":"2024-04-20T17:30:09","guid":{"rendered":"https:\/\/fabrizio.vanzani.it\/?p=113"},"modified":"2024-04-20T18:34:23","modified_gmt":"2024-04-20T17:34:23","slug":"use-access-token-as-bearer-token-to-access-magento-api","status":"publish","type":"post","link":"https:\/\/fabrizio.vanzani.it\/?p=113","title":{"rendered":"Use Access Token as Bearer token to access Magento Api"},"content":{"rendered":"\n<p>Starting from recent Magento (and Adobe Commerce) versions (ver. 2.4.4) Adobe introduced a new configuration in the Oauth section.<\/p>\n\n\n\n<p>By default Magento no longer allows to access API using the sole integration Access Token.<\/p>\n\n\n\n<p>In order to restore the old behaviour you have to set to yes the following setting:<\/p>\n\n\n\n<p><em>Stores &gt; Configuration &gt; Services &gt; OAuth &gt; Consumer Settings &gt; Allow OAuth Access Tokens to be used as standalone Bearer tokens <\/em><\/p>\n\n\n\n<p>Alternatively by command line:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"m2 config:set oauth\/consumer\/enable_integration_as_bearer 1\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">m2<\/span><span style=\"color: #D8DEE9FF\"> config<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9\">set<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">oauth<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">consumer<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">enable_integration_as_bearer<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>See Adobe Documentation: <a href=\"https:\/\/developer.adobe.com\/commerce\/webapi\/get-started\/authentication\/gs-authentication-token\/\">https:\/\/developer.adobe.com\/commerce\/webapi\/get-started\/authentication\/gs-authentication-token\/<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Starting from magento 2.4.4 you cannot access magento api with an integration Access Token unless you unlock a Oauth setting.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,4],"tags":[33,32],"class_list":["post-113","post","type-post","status-publish","format-standard","hentry","category-2-x","category-magento","tag-api","tag-token"],"_links":{"self":[{"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=113"}],"version-history":[{"count":2,"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=\/wp\/v2\/posts\/113\/revisions"}],"predecessor-version":[{"id":115,"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=\/wp\/v2\/posts\/113\/revisions\/115"}],"wp:attachment":[{"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fabrizio.vanzani.it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}