{"action":"created","issue":{"url":"https://api.github.com/repos/ChrisAlvares/node-adwords/issues/31","repository_url":"https://api.github.com/repos/ChrisAlvares/node-adwords","labels_url":"https://api.github.com/repos/ChrisAlvares/node-adwords/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/ChrisAlvares/node-adwords/issues/31/comments","events_url":"https://api.github.com/repos/ChrisAlvares/node-adwords/issues/31/events","html_url":"https://github.com/ChrisAlvares/node-adwords/issues/31","id":225347318,"number":31,"title":"Where to pass access_token","user":{"login":"purplecones","id":136654,"avatar_url":"https://avatars1.githubusercontent.com/u/136654?v=3","gravatar_id":"","url":"https://api.github.com/users/purplecones","html_url":"https://github.com/purplecones","followers_url":"https://api.github.com/users/purplecones/followers","following_url":"https://api.github.com/users/purplecones/following{/other_user}","gists_url":"https://api.github.com/users/purplecones/gists{/gist_id}","starred_url":"https://api.github.com/users/purplecones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purplecones/subscriptions","organizations_url":"https://api.github.com/users/purplecones/orgs","repos_url":"https://api.github.com/users/purplecones/repos","events_url":"https://api.github.com/users/purplecones/events{/privacy}","received_events_url":"https://api.github.com/users/purplecones/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-04-30T19:08:12Z","updated_at":"2017-05-01T18:25:57Z","closed_at":null,"body":"Where do I pass the `access_token` I receive from `getAccessTokenFromAuthorizationCode()`?\r\n\r\nI keep getting `AuthorizationError.USER_PERMISSION_DENIED` when calling `campaignService.get()`.\r\n\r\nI'm trying to establish my first API call to AdWords and pull some campaign data. Here is the code that throws the permission error.\r\n\r\n```javascript\r\nlet auth = new AdwordsAuth({\r\n    client_id: 'xxx',\r\n    client_secret: 'xxx'\r\n}, 'http://localhost:3000/adwords/auth' /** insert your redirect url here */);\r\n\r\napp.get('/', (req, res) => {\r\n    res.redirect(auth.generateAuthenticationUrl());\r\n})\r\napp.get('/adwords/auth', (req, res) => {\r\n    auth.getAccessTokenFromAuthorizationCode(req.query.code, (error, tokens) => {\r\n        console.log('tokens...');\r\n        console.logFull({ error, tokens });\r\n        //save access and especially the refresh tokens here\r\n\r\n          let user = new AdwordsUser({\r\n              developerToken: 'xxxx', //your adwords developerToken\r\n              userAgent: 'xxx', //any company name\r\n              clientCustomerId: 'xxxx', //the Adwords Account id (e.g. 123-123-123)\r\n              client_id: 'xxxx', //this is the api console client_id\r\n              client_secret: 'xxxx',\r\n              refresh_token: tokens.refresh_token,\r\n          });\r\n\r\n          let campaignService = user.getService('CampaignService', 'v201702');\r\n  \r\n          let selector = {\r\n              fields: ['Id', 'Name'],\r\n              ordering: [{field: 'Name', sortOrder: 'ASCENDING'}],\r\n              paging: {startIndex: 0, numberResults: AdwordsConstants.RECOMMENDED_PAGE_SIZE}\r\n          };\r\n\r\n          campaignService.get({ serviceSelector: selector }, (error, result) => {\r\n              console.log(result.body);\r\n              res.send(result)\r\n          });\r\n    })\r\n});\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ChrisAlvares/node-adwords/issues/comments/298394647","html_url":"https://github.com/ChrisAlvares/node-adwords/issues/31#issuecomment-298394647","issue_url":"https://api.github.com/repos/ChrisAlvares/node-adwords/issues/31","id":298394647,"user":{"login":"purplecones","id":136654,"avatar_url":"https://avatars1.githubusercontent.com/u/136654?v=3","gravatar_id":"","url":"https://api.github.com/users/purplecones","html_url":"https://github.com/purplecones","followers_url":"https://api.github.com/users/purplecones/followers","following_url":"https://api.github.com/users/purplecones/following{/other_user}","gists_url":"https://api.github.com/users/purplecones/gists{/gist_id}","starred_url":"https://api.github.com/users/purplecones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purplecones/subscriptions","organizations_url":"https://api.github.com/users/purplecones/orgs","repos_url":"https://api.github.com/users/purplecones/repos","events_url":"https://api.github.com/users/purplecones/events{/privacy}","received_events_url":"https://api.github.com/users/purplecones/received_events","type":"User","site_admin":false},"created_at":"2017-05-01T18:25:57Z","updated_at":"2017-05-01T18:25:57Z","body":"I was able to gain access to the AdWords data with the following object.\r\n\r\n```javascript\r\n      let user = new AdwordsUser({\r\n        developerToken: 'xxx', // your adwords developerToken\r\n        userAgent: 'xxx', // any company name\r\n        clientCustomerId: 'xxx-xxx-xxxx', // the Adwords Account id (e.g. 123-123-123)\r\n        client_id: 'xxx',\r\n        client_secret: 'xxx',\r\n        refresh_token: tokens.refresh_token,\r\n        access_token: tokens.access_token,\r\n      });\r\n```\r\nbut it only works if I specify the `clientCustomerId` of the AdWords account that is giving my app the permission. I currently hardcoded because I own the account but how would I get the `clientCustomerId` from a user after the OAuth ?\r\n"}}
{"actor":{"display_login":"purplecones"}}