{"action":"created","issue":{"url":"https://api.github.com/repos/magento/magento2/issues/4335","repository_url":"https://api.github.com/repos/magento/magento2","labels_url":"https://api.github.com/repos/magento/magento2/issues/4335/labels{/name}","comments_url":"https://api.github.com/repos/magento/magento2/issues/4335/comments","events_url":"https://api.github.com/repos/magento/magento2/issues/4335/events","html_url":"https://github.com/magento/magento2/issues/4335","id":151585706,"number":4335,"title":"2 REST API Authorization failed while creating product","user":{"login":"Taral-Patoliya","id":10272277,"avatar_url":"https://avatars.githubusercontent.com/u/10272277?v=3","gravatar_id":"","url":"https://api.github.com/users/Taral-Patoliya","html_url":"https://github.com/Taral-Patoliya","followers_url":"https://api.github.com/users/Taral-Patoliya/followers","following_url":"https://api.github.com/users/Taral-Patoliya/following{/other_user}","gists_url":"https://api.github.com/users/Taral-Patoliya/gists{/gist_id}","starred_url":"https://api.github.com/users/Taral-Patoliya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Taral-Patoliya/subscriptions","organizations_url":"https://api.github.com/users/Taral-Patoliya/orgs","repos_url":"https://api.github.com/users/Taral-Patoliya/repos","events_url":"https://api.github.com/users/Taral-Patoliya/events{/privacy}","received_events_url":"https://api.github.com/users/Taral-Patoliya/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/magento/magento2/labels/acknowledged","name":"acknowledged","color":"02d7e1"},{"url":"https://api.github.com/repos/magento/magento2/labels/PS","name":"PS","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-28T09:03:20Z","updated_at":"2016-04-29T19:19:57Z","closed_at":null,"body":"I am trying to create a simple product using REST Api. The client is a node.js script,\r\n\r\nI have created an admin user with access to all the resources, and used the credentials to request a token which i am getting successfully in a response. but when i try to use that token and post the product data, i get following response\r\n\r\n```\r\nConsumer is not authorized to access %resources\r\n{ resources: 'Magento_Catalog::products' }\r\n#0 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(286): Magento\\Webapi\\Controller\\Rest->checkPermissions()\r\n#1 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(255): Magento\\Webapi\\Controller\\Rest->validateRequest()\r\n#2 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(160): Magento\\Webapi\\Controller\\Rest->processApiRequest()\r\n#3 /var/www/html/magento2/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(24): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\r\n#4 /var/www/html/magento2/vendor/magento/framework/App/Http.php(115): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\r\n#5 /var/www/html/magento2/vendor/magento/framework/App/Bootstrap.php(258): Magento\\Framework\\App\\Http->launch()\r\n#6 /var/www/html/magento2/index.php(40): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\r\n#7 {main}\r\n```\r\n\r\n1. I have given access of all the resources to the user.\r\n2. I am getting the token from this endpoint integration/admin/token\r\n3. The request i am sending in the post is like following\r\n```\r\n{ method: 'post', encoding: 'utf8', username: 'node_rest', password: 'test@123', headers: { Accept: 'application/json', 'Content-Type': 'application/json', Authorization: 'Bearer pyd825eg8xho1f4q4lxko4lmejlwhulx' },\r\ndata: '{\"sku\":[\"24-MB01-DUP\"],\"store_view_code\":[\"\"],\"attribute_set_code\":[\"Bag\"],\"product_type\":[\"simple\"],\"categories\":[\"Default Category/Gear,Default Category/Gear/Bags\"],\"product_websites\":[\"base\"],\"name\":[\"Joust Duffle Bag Duplicate\"],\"description\":[\"The sporty Joust Duffle Bag can\\'t be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it\\'s ideal for athletes with places to go.\r\n\r\n\\\\n\\\\n\r\nDual top handles.</li>\\\\n\r\nAdjustable shoulder strap.</li>\\\\n\r\nFull-length zipper.</li>\\\\n\r\nL 29\\\\\" x W 13\\\\\" x H 11\\\\\".</li>\\\\n</ul>]]>\"],\"short_description\":[\"\"],\"weight\":[\"\"],\"product_online\":[\"1\"],\"tax_class_name\":[\"Taxable Goods\"],\"visibility\":[\"Catalog, Search\"],\"price\":[\"34.0000\"],\"special_price\":[\"\"],\"special_price_from_date\":[\"\"],\"special_price_to_date\":[\"\"],\"url_key\":[\"joust-duffle-bag\"],\"meta_title\":[\"\"],\"meta_keywords\":[\"\"],\"meta_description\":[\"\"],\"base_image\":[\"/m/b/mb01-blue-0.jpg\"],\"base_image_label\":[\"\"],\"small_image\":[\"/m/b/mb01-blue-0.jpg\"],\"small_image_label\":[\"\"],\"thumbnail_image\":[\"/m/b/mb01-blue-0.jpg\"],\"thumbnail_image_label\":[\"\"],\"swatch_image\":[\"\"],\"swatch_image_label\":[\"\"],\"created_at\":[\"3/15/16, 10:41 AM\"],\"updated_at\":[\"3/15/16, 10:41 AM\"],\"new_from_date\":[\"\"],\"new_to_date\":[\"\"],\"display_product_options_in\":[\"Block after Info Column\"],\"map_price\":[\"\"],\"msrp_price\":[\"\"],\"map_enabled\":[\"\"],\"gift_message_available\":[\"\"],\"custom_design\":[\"\"],\"custom_design_from\":[\"\"],\"custom_design_to\":[\"\"],\"custom_layout_update\":[\"\"],\"page_layout\":[\"\"],\"product_options_container\":[\"\"],\"msrp_display_actual_price_type\":[\"\"],\"country_of_manufacture\":[\"\"],\"additional_attributes\":[\"activity=Gym|Overnight|Trail|Travel,features_bags=Waterproof|TSA Approved|Lockable,material=Nylon|Polyester,strap_bags=Adjustable|Cross Body|Detachable|Double|Padded|Shoulder,style_bags=Luggage|Duffel|Exercise\"],\"qty\":[\"100.0000\"],\"out_of_stock_qty\":[\"0.0000\"],\"use_config_min_qty\":[\"1\"],\"is_qty_decimal\":[\"0\"],\"allow_backorders\":[\"0\"],\"use_config_backorders\":[\"1\"],\"min_cart_qty\":[\"1.0000\"],\"use_config_min_sale_qty\":[\"1\"],\"max_cart_qty\":[\"0.0000\"],\"use_config_max_sale_qty\":[\"1\"],\"is_in_stock\":[\"1\"],\"notify_on_stock_below\":[\"\"],\"use_config_notify_stock_qty\":[\"1\"],\"manage_stock\":[\"0\"],\"use_config_manage_stock\":[\"1\"],\"use_config_qty_increments\":[\"1\"],\"qty_increments\":[\"0.0000\"],\"use_config_enable_qty_inc\":[\"1\"],\"enable_qty_increments\":[\"0\"],\"is_decimal_divided\":[\"0\"],\"website_id\":[\"1\"],\"related_skus\":[\"\"],\"crosssell_skus\":[\"\"],\"upsell_skus\":[\"24-MB03,24-MB05,24-MB06,24-MB02,24-UB02,24-WB03,24-WB07,24-WB04\"],\"additional_images\":[\"/m/b/mb01-blue-0.jpg\"],\"additional_image_labels\":[\"Image\"],\"hide_from_product_page\":[\"\"],\"bundle_price_type\":[\"\"],\"bundle_sku_type\":[\"\"],\"bundle_price_view\":[\"\"],\"bundle_weight_type\":[\"\"],\"bundle_values\":[\"\"],\"associated_skus\":[\"\"]}' }\r\n```\r\n\r\nI know that the data in the request is disoriented and not structured but i don't think that it should have anything to do with authorization, the data format deserves its own error :D\r\n\r\nSorry for the bad formatting of the request data but the Editor's functionality could not reformat the data\r\n"},"comment":{"url":"https://api.github.com/repos/magento/magento2/issues/comments/215853575","html_url":"https://github.com/magento/magento2/issues/4335#issuecomment-215853575","issue_url":"https://api.github.com/repos/magento/magento2/issues/4335","id":215853575,"user":{"login":"hshar7","id":17727543,"avatar_url":"https://avatars.githubusercontent.com/u/17727543?v=3","gravatar_id":"","url":"https://api.github.com/users/hshar7","html_url":"https://github.com/hshar7","followers_url":"https://api.github.com/users/hshar7/followers","following_url":"https://api.github.com/users/hshar7/following{/other_user}","gists_url":"https://api.github.com/users/hshar7/gists{/gist_id}","starred_url":"https://api.github.com/users/hshar7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hshar7/subscriptions","organizations_url":"https://api.github.com/users/hshar7/orgs","repos_url":"https://api.github.com/users/hshar7/repos","events_url":"https://api.github.com/users/hshar7/events{/privacy}","received_events_url":"https://api.github.com/users/hshar7/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T19:19:57Z","updated_at":"2016-04-29T19:19:57Z","body":"Okay thanks! Investigating."}}