Invalid Developer Token
The most common error, encountered by developers making API calls for the first time, is "The developer token is invalid." (Error code 42). There are couple of main reasons you may get this error.
- If this is your first time making the call, make sure that you're making calls to the account in production environment (adwords.google.com) rather than the AdWords API sandbox (sandbox.google.com). API sample code is configured by default to send the requests to sandbox account and not production account. Thus, if you started programming using this code, this is the most likely reason for the error.
- Similarly, if you are using an AdWords API client library, they are also configured by default to send request to the AdWords API sandbox. If you are using Java, .NET or Ruby client libraries, make sure that you haven't provided "alternateUrl" key as part of user credentials in the configuration file (adwords.properties or app.config). For Apility library, make sure that Use_Sandbox key is set as 'No' in settings.ini file. For python client library, make sure you haven't provided an argument server="'https://sandbox.google.com/'" when initializing service class. Also, each library has an appropriate constructor which will accept the credentials as parameters while initializing the library. Make sure that you haven't provided "alternateUrl" here as well. Finally, some libraries might provide utility functions (e.g. .NET client library provides useSandbox()) that will allow you to switch between production and sandbox accounts at runtime. Make sure that these functions are not called in your code.
- A less common, but more obvious, reason for this error is that the token in your code is invalid. The chance of this happening is low, since most developers copy their token from their MCC account. Nevertheless, it could happen if you've mistakenly swapped the application and developer tokens, or if you've reset the developer token in your account but forgotten to update your code. Double checking your code should help you spot the reason for the error.
Next time, we'll explore errors related to missing headers in SOAP requests. Keep an eye on the blog for upcoming posts.
--Anash Oommen, AdWords API Team
Link - from AdWords API Blog
Related: The Text Tool: enabling your photos to speak for themselves