{"id":511,"date":"2021-03-19T06:16:24","date_gmt":"2021-03-19T06:16:24","guid":{"rendered":"https:\/\/cyberchunk.com\/?p=511"},"modified":"2023-08-07T10:34:51","modified_gmt":"2023-08-07T10:34:51","slug":"create-magento-2-admin-token","status":"publish","type":"post","link":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/","title":{"rendered":"How to create Magento 2 Admin token."},"content":{"rendered":"\n<p>Magento 2 Admin Token REST API, you need to first generate an access token. The access token used for synchronization with Magento to another third-party platform.<\/p>\n\n\n\n<p>Without an Access token, you can\u2019t communicate with Magento 2. For Create an access token you need to call POST action with Request payload. Your request URL will be <strong>rest\/V1\/integration\/admin\/token<\/strong> append to your site URL.<\/p>\n\n\n\n<p>Pass the username and password in the request body of the Magento backend to generate the Access token.<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<pre class=\"wp-block-code\"><code>&lt;?php\n$url = \"http:\/\/127.0.0.1\/magento241\/index.php\/rest\";\n$token_url = $url.\"\/V1\/integration\/admin\/token\";\n$username = \"admin\";\n$password = \"admin123\";\n\n\/\/Authentication rest API magento2, For get access token\n$ch = curl_init();\n$data = array(\"username\" =&gt; $username, \"password\" =&gt; $password);\n$data_string = json_encode($data);\n\n$ch = curl_init();\ncurl_setopt($ch,CURLOPT_URL, $token_url);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\ncurl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application\/json'));\n$token = curl_exec($ch);\n$accessToken = json_decode($token);\necho $accessToken;<\/code><\/pre>\n\n\n\n<p>After successfully call with Magento 2, You can get a response as a string with Access Token. You can use access token with any Magento 2 REST API call with \u201c<strong>Bearer {$accessToken}<\/strong>\u201d<\/p>\n\n\n\n<p>Output:<br><strong>qhkk60btde5681tfvvhd921sw2051t02<\/strong><\/p>\n\n\n\n<p>You can use the token in a Web API request as below,<br><strong>Authorization: Bearer &lt;access token&gt;<\/strong><br>Where Replace &lt;access token&gt; token with your actual access token.<\/p>\n\n\n\n<p>Postman Screen to generate Admin Token for the Magento 2,<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"659\" src=\"https:\/\/cyberchunk.com\/wp-content\/uploads\/2021\/03\/oie_xDfl6MVjDzfE-1024x659.jpg\" alt=\"\" class=\"wp-image-512\" srcset=\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/oie_xDfl6MVjDzfE-1024x659.jpg 1024w, https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/oie_xDfl6MVjDzfE-300x193.jpg 300w, https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/oie_xDfl6MVjDzfE-768x494.jpg 768w, https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/oie_xDfl6MVjDzfE.jpg 1420w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2 Admin Token REST API, you need to first generate an access token. The access token used for synchronization with Magento to another third-party &hellip;<\/p>\n","protected":false},"author":1,"featured_media":514,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[111,82,112],"class_list":["post-511","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento","tag-magento","tag-magento2","tag-token"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v18.5 (Yoast SEO v25.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Create Magento 2 Admin Token: A Step-by-Step Guide<\/title>\n<meta name=\"description\" content=\"Learn the step-by-step process to create a Magento 2 Admin token for secure and authorized access to your e-commerce store&#039;s backend.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create Magento 2 Admin token.\" \/>\n<meta property=\"og:description\" content=\"Learn the step-by-step process to create a Magento 2 Admin token for secure and authorized access to your e-commerce store&#039;s backend.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/\" \/>\n<meta property=\"og:site_name\" content=\"Pracoda Technologies\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cyberchunkin\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-19T06:16:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-07T10:34:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"prakash\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"prakash\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/\"},\"author\":{\"name\":\"prakash\",\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/person\/758a6d1f2973de0cff80453cd6eb299e\"},\"headline\":\"How to create Magento 2 Admin token.\",\"datePublished\":\"2021-03-19T06:16:24+00:00\",\"dateModified\":\"2023-08-07T10:34:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/\"},\"wordCount\":163,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/pracoda.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png\",\"keywords\":[\"magento\",\"Magento2\",\"token\"],\"articleSection\":[\"Magento\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/\",\"url\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/\",\"name\":\"How to Create Magento 2 Admin Token: A Step-by-Step Guide\",\"isPartOf\":{\"@id\":\"https:\/\/pracoda.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png\",\"datePublished\":\"2021-03-19T06:16:24+00:00\",\"dateModified\":\"2023-08-07T10:34:51+00:00\",\"description\":\"Learn the step-by-step process to create a Magento 2 Admin token for secure and authorized access to your e-commerce store's backend.\",\"breadcrumb\":{\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#primaryimage\",\"url\":\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png\",\"contentUrl\":\"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png\",\"width\":825,\"height\":450},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/pracoda.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create Magento 2 Admin token.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/pracoda.com\/blog\/#website\",\"url\":\"https:\/\/pracoda.com\/blog\/\",\"name\":\"Pracoda Technologies\",\"description\":\"Unveiling the Digital Landscape: Navigating Tech, Scams, and Societal Shifts\",\"publisher\":{\"@id\":\"https:\/\/pracoda.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/pracoda.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/pracoda.com\/blog\/#organization\",\"name\":\"CyberChunk\",\"url\":\"https:\/\/pracoda.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cyberchunk.com\/wp-content\/uploads\/2023\/08\/CyberChunk-Logos-1-1.png\",\"contentUrl\":\"https:\/\/cyberchunk.com\/wp-content\/uploads\/2023\/08\/CyberChunk-Logos-1-1.png\",\"width\":1409,\"height\":293,\"caption\":\"CyberChunk\"},\"image\":{\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/cyberchunkin\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/person\/758a6d1f2973de0cff80453cd6eb299e\",\"name\":\"prakash\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pracoda.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/af9d52a696766d27b7ffcff0321f8743973b88cbd4c13d9594dfc0d4744913c3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/af9d52a696766d27b7ffcff0321f8743973b88cbd4c13d9594dfc0d4744913c3?s=96&d=mm&r=g\",\"caption\":\"prakash\"},\"description\":\"The proactive Magento developer, DevOps expert, and e-commerce consultant behind Pracoda Technologies is the driving force behind our commitment to delivering excellence in software solutions. With a diverse skill set, strategic mindset, and collaborative approach, our leadership ensures we remain at the forefront of innovation, consistently propelling clients toward success and customer satisfaction as we navigate the ever-evolving e-commerce landscape.\",\"sameAs\":[\"https:\/\/cyberchunk.com\"],\"knowsAbout\":[\"CyberSecurity\"],\"knowsLanguage\":[\"English\"],\"jobTitle\":\"Senior Software Enginner\",\"worksFor\":\"Pracoda Technologies\",\"url\":\"https:\/\/pracoda.com\/blog\/author\/prakash\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Create Magento 2 Admin Token: A Step-by-Step Guide","description":"Learn the step-by-step process to create a Magento 2 Admin token for secure and authorized access to your e-commerce store's backend.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/","og_locale":"en_US","og_type":"article","og_title":"How to create Magento 2 Admin token.","og_description":"Learn the step-by-step process to create a Magento 2 Admin token for secure and authorized access to your e-commerce store's backend.","og_url":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/","og_site_name":"Pracoda Technologies","article_publisher":"https:\/\/www.facebook.com\/cyberchunkin\/","article_published_time":"2021-03-19T06:16:24+00:00","article_modified_time":"2023-08-07T10:34:51+00:00","og_image":[{"width":825,"height":450,"url":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png","type":"image\/png"}],"author":"prakash","twitter_card":"summary_large_image","twitter_misc":{"Written by":"prakash","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#article","isPartOf":{"@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/"},"author":{"name":"prakash","@id":"https:\/\/pracoda.com\/blog\/#\/schema\/person\/758a6d1f2973de0cff80453cd6eb299e"},"headline":"How to create Magento 2 Admin token.","datePublished":"2021-03-19T06:16:24+00:00","dateModified":"2023-08-07T10:34:51+00:00","mainEntityOfPage":{"@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/"},"wordCount":163,"commentCount":0,"publisher":{"@id":"https:\/\/pracoda.com\/blog\/#organization"},"image":{"@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#primaryimage"},"thumbnailUrl":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png","keywords":["magento","Magento2","token"],"articleSection":["Magento"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/","url":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/","name":"How to Create Magento 2 Admin Token: A Step-by-Step Guide","isPartOf":{"@id":"https:\/\/pracoda.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#primaryimage"},"image":{"@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#primaryimage"},"thumbnailUrl":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png","datePublished":"2021-03-19T06:16:24+00:00","dateModified":"2023-08-07T10:34:51+00:00","description":"Learn the step-by-step process to create a Magento 2 Admin token for secure and authorized access to your e-commerce store's backend.","breadcrumb":{"@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#primaryimage","url":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png","contentUrl":"https:\/\/pracoda.com\/blog\/wp-content\/uploads\/2021\/03\/megento-auth.png","width":825,"height":450},{"@type":"BreadcrumbList","@id":"https:\/\/pracoda.com\/blog\/create-magento-2-admin-token\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pracoda.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to create Magento 2 Admin token."}]},{"@type":"WebSite","@id":"https:\/\/pracoda.com\/blog\/#website","url":"https:\/\/pracoda.com\/blog\/","name":"Pracoda Technologies","description":"Unveiling the Digital Landscape: Navigating Tech, Scams, and Societal Shifts","publisher":{"@id":"https:\/\/pracoda.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pracoda.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pracoda.com\/blog\/#organization","name":"CyberChunk","url":"https:\/\/pracoda.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pracoda.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cyberchunk.com\/wp-content\/uploads\/2023\/08\/CyberChunk-Logos-1-1.png","contentUrl":"https:\/\/cyberchunk.com\/wp-content\/uploads\/2023\/08\/CyberChunk-Logos-1-1.png","width":1409,"height":293,"caption":"CyberChunk"},"image":{"@id":"https:\/\/pracoda.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cyberchunkin\/"]},{"@type":"Person","@id":"https:\/\/pracoda.com\/blog\/#\/schema\/person\/758a6d1f2973de0cff80453cd6eb299e","name":"prakash","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pracoda.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/af9d52a696766d27b7ffcff0321f8743973b88cbd4c13d9594dfc0d4744913c3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/af9d52a696766d27b7ffcff0321f8743973b88cbd4c13d9594dfc0d4744913c3?s=96&d=mm&r=g","caption":"prakash"},"description":"The proactive Magento developer, DevOps expert, and e-commerce consultant behind Pracoda Technologies is the driving force behind our commitment to delivering excellence in software solutions. With a diverse skill set, strategic mindset, and collaborative approach, our leadership ensures we remain at the forefront of innovation, consistently propelling clients toward success and customer satisfaction as we navigate the ever-evolving e-commerce landscape.","sameAs":["https:\/\/cyberchunk.com"],"knowsAbout":["CyberSecurity"],"knowsLanguage":["English"],"jobTitle":"Senior Software Enginner","worksFor":"Pracoda Technologies","url":"https:\/\/pracoda.com\/blog\/author\/prakash\/"}]}},"_links":{"self":[{"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/posts\/511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/comments?post=511"}],"version-history":[{"count":3,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":727,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/posts\/511\/revisions\/727"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/media\/514"}],"wp:attachment":[{"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/media?parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/categories?post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pracoda.com\/blog\/wp-json\/wp\/v2\/tags?post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}