Created AdWordsUser doesn't have authorization token

7 views
Skip to first unread message

ironside....@gmail.com

unread,
Apr 20, 2018, 1:02:19 PM4/20/18
to AdWords API Forum
Hi.
I'm trying to get TargetingIdeaService up and running using ASP.NET.
I'm building my app as a REST API, so console solutions won't work.
This is my code so far:

        [HttpGet]
        public IEnumerable<string> Get()
        {
            var user = new AdWordsUser();
            using (TargetingIdeaService targetingIdeaService = (TargetingIdeaService)user.GetService(AdWordsService.v201802.TargetingIdeaService))
            {
                // Create selector.
                TargetingIdeaSelector selector = new TargetingIdeaSelector();
                selector.requestType = RequestType.IDEAS;
                selector.ideaType = IdeaType.KEYWORD;
                selector.requestedAttributeTypes = new AttributeType[] {
                AttributeType.KEYWORD_TEXT,
                AttributeType.SEARCH_VOLUME,
                AttributeType.AVERAGE_CPC,
                AttributeType.COMPETITION,
                AttributeType.CATEGORY_PRODUCTS_AND_SERVICES
            };

                // Set selector paging (required for targeting idea service).
                var paging = Paging.Default;
                // Create related to query search parameter.
                var relatedToQuerySearchParameter = new RelatedToQuerySearchParameter { queries = new String[] { "bakery", "pastries", "birthday cake" } };

                var searchParameters = new List<SearchParameter> { relatedToQuerySearchParameter };

                var page = new TargetingIdeaPage();
                page = targetingIdeaService.get(selector);
                return new string[] { "value1", "value2" };
            }
        }

So it all looks good, but when debugging I realized that the "user" object doesn't have the authorization token (the property is empty). All credentials are correctly stored in app.config. The object has developer token and so on, but doesn't generate authorization token.
I know I'm missing something, but I have no idea what.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages