{"action":"created","issue":{"url":"https://api.github.com/repos/discordapp/discord-api-docs/issues/628","repository_url":"https://api.github.com/repos/discordapp/discord-api-docs","labels_url":"https://api.github.com/repos/discordapp/discord-api-docs/issues/628/labels{/name}","comments_url":"https://api.github.com/repos/discordapp/discord-api-docs/issues/628/comments","events_url":"https://api.github.com/repos/discordapp/discord-api-docs/issues/628/events","html_url":"https://github.com/discordapp/discord-api-docs/issues/628","id":343335713,"node_id":"MDU6SXNzdWUzNDMzMzU3MTM=","number":628,"title":"Why is this unauthorised","user":{"login":"ltkarim","id":36323832,"node_id":"MDQ6VXNlcjM2MzIzODMy","avatar_url":"https://avatars0.githubusercontent.com/u/36323832?v=4","gravatar_id":"","url":"https://api.github.com/users/ltkarim","html_url":"https://github.com/ltkarim","followers_url":"https://api.github.com/users/ltkarim/followers","following_url":"https://api.github.com/users/ltkarim/following{/other_user}","gists_url":"https://api.github.com/users/ltkarim/gists{/gist_id}","starred_url":"https://api.github.com/users/ltkarim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ltkarim/subscriptions","organizations_url":"https://api.github.com/users/ltkarim/orgs","repos_url":"https://api.github.com/users/ltkarim/repos","events_url":"https://api.github.com/users/ltkarim/events{/privacy}","received_events_url":"https://api.github.com/users/ltkarim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-21T15:46:50Z","updated_at":"2018-07-21T16:50:10Z","closed_at":null,"author_association":"NONE","body":"Hey,\r\n\r\nI have been trying to solve this for a couple of hours now but I can't seem to find out what's causing it, I've double checked scopes, tokens, and everything in my code and it doesn't seem to work still. \r\n\r\nI am certain that my access token is valid and the request should be too. I have a bot with ``bot guilds.join`` scope which is from an application that's created by the user id in the request below  authorized.\r\n\r\nI have queried ``https://discordapp.com/api/v6/oauth2/token`` with the necessary details which I am also certain to be right, to get the access token I have redacted in the request below.\r\n\r\nThe token query:\r\n```js\r\nlet tokenQuery = [\r\n    'grant_type=authorization_code',\r\n    `code=${code}`,\r\n    `client_id=${Config.Application}`,\r\n    `client_secret=${Config.Secret}`,\r\n    `redirect_uri=${Config.Redirect}`,\r\n].join('&');\r\n```\r\n\r\nThis is some debug info from the request:\r\n\r\n```c\r\n_data:Object {access_token: \"---\"}\r\nheader:Object {User-Agent: \"DiscordBot (---, 100)\", Content-Type: \"application/json\", Authorization: \"Bearer ---\"}\r\nhost:\"discordapp.com\"\r\nmethod:\"PUT\"\r\nprotocol:\"https:\"\r\nurl:\"https://discordapp.com/api/v6/guilds/470203424730775572/members/470203324982099968\"\r\n```\r\n\r\nThe response:\r\n```c\r\n\r\nmessage:\"cannot PUT /api/v6/guilds/470203424730775572/members/470203324982099968 (401)\"\r\nmethod:\"PUT\"\r\npath:\"/api/v6/guilds/470203424730775572/members/470203324982099968\"\r\nstatus:401\r\ntext:\"{\"code\": 0, \"message\": \"401: Unauthorized\"}\"\r\n```\r\n\r\nI would appreciate some help. "},"comment":{"url":"https://api.github.com/repos/discordapp/discord-api-docs/issues/comments/406809194","html_url":"https://github.com/discordapp/discord-api-docs/issues/628#issuecomment-406809194","issue_url":"https://api.github.com/repos/discordapp/discord-api-docs/issues/628","id":406809194,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjgwOTE5NA==","user":{"login":"CarsonHoffman","id":19721219,"node_id":"MDQ6VXNlcjE5NzIxMjE5","avatar_url":"https://avatars2.githubusercontent.com/u/19721219?v=4","gravatar_id":"","url":"https://api.github.com/users/CarsonHoffman","html_url":"https://github.com/CarsonHoffman","followers_url":"https://api.github.com/users/CarsonHoffman/followers","following_url":"https://api.github.com/users/CarsonHoffman/following{/other_user}","gists_url":"https://api.github.com/users/CarsonHoffman/gists{/gist_id}","starred_url":"https://api.github.com/users/CarsonHoffman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarsonHoffman/subscriptions","organizations_url":"https://api.github.com/users/CarsonHoffman/orgs","repos_url":"https://api.github.com/users/CarsonHoffman/repos","events_url":"https://api.github.com/users/CarsonHoffman/events{/privacy}","received_events_url":"https://api.github.com/users/CarsonHoffman/received_events","type":"User","site_admin":false},"created_at":"2018-07-21T16:50:10Z","updated_at":"2018-07-21T16:50:10Z","author_association":"CONTRIBUTOR","body":"Is the bot you're using to perform the request attached to the *same* application which you used to obtain the bearer token for the user? That's a requirement for this endpoint."}}
{"actor":{"display_login":"CarsonHoffman"}}