{"action":"closed","issue":{"url":"https://api.github.com/repos/gothinkster/realworld/issues/259","repository_url":"https://api.github.com/repos/gothinkster/realworld","labels_url":"https://api.github.com/repos/gothinkster/realworld/issues/259/labels{/name}","comments_url":"https://api.github.com/repos/gothinkster/realworld/issues/259/comments","events_url":"https://api.github.com/repos/gothinkster/realworld/issues/259/events","html_url":"https://github.com/gothinkster/realworld/issues/259","id":355532765,"node_id":"MDU6SXNzdWUzNTU1MzI3NjU=","number":259,"title":"POST /api/articles works fine on Postman but giving Unauthorized error while requesting from superagent","user":{"login":"blackdeve","id":36166782,"node_id":"MDQ6VXNlcjM2MTY2Nzgy","avatar_url":"https://avatars3.githubusercontent.com/u/36166782?v=4","gravatar_id":"","url":"https://api.github.com/users/blackdeve","html_url":"https://github.com/blackdeve","followers_url":"https://api.github.com/users/blackdeve/followers","following_url":"https://api.github.com/users/blackdeve/following{/other_user}","gists_url":"https://api.github.com/users/blackdeve/gists{/gist_id}","starred_url":"https://api.github.com/users/blackdeve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blackdeve/subscriptions","organizations_url":"https://api.github.com/users/blackdeve/orgs","repos_url":"https://api.github.com/users/blackdeve/repos","events_url":"https://api.github.com/users/blackdeve/events{/privacy}","received_events_url":"https://api.github.com/users/blackdeve/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-30T10:57:33Z","updated_at":"2018-08-30T13:13:30Z","closed_at":"2018-08-30T13:13:30Z","author_association":"NONE","body":"Here's my code:\r\n```\r\nimport superagentPromise from 'superagent-promise';\r\nimport _superagent from 'superagent';\r\n\r\nconst superagent = superagentPromise(_superagent, global.Promise);\r\nconst API_ROOT = 'http://localhost:3000/api';\r\n\r\nconst Articles = {\r\n    create: article =>\r\n    superagent.post(`${API_ROOT}/articles`, { article })\r\n      .set('Content-Type', 'application/json')\r\n      .set('Authorization', `Token ${token}`)\r\n      .set('X-Requested-With', 'XMLHttpRequest')\r\n      .then(res => res.body)\r\n}\r\n```\r\n\r\nThis is error log of the Articles.create() function.\r\n![issue](https://user-images.githubusercontent.com/36166782/44847524-1eb4ba80-ac97-11e8-8807-41f7b2b68cde.png)\r\n\r\nIs there anyone who can fix this issue for me?\r\nThanks in advance!\r\n"}}
{"actor":{"display_login":"anishkny"}}