CallStructure - Authorization : Bearer YOUR_ACCESS_TOKEN

290 views
Skip to first unread message

Germán Darío Ruiz

unread,
Mar 8, 2018, 3:45:32 PM3/8/18
to AdWords API Forum

I needs to understand in which part of the request does the authorization token implemented? I received error AuthenticationError.LOGIN_COOKIE_REQUIRED and if i add the token it is AuthenticationError.OAUTH_TOKEN_INVALID. Could someone help me with an example or undestand what is missing? I used SoapUi for try the call.

 

-          Requerst to AdwordsUserListService with mutateMembers operation:

-          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://adwords.google.com/api/adwords/rm/v201710" xmlns:v201="https://adwords.google.com/api/adwords/cm/v201710">

-             <soapenv:Header>

-                <v20:RequestHeader>

-                   <v201:clientCustomerId>customerID</v201:clientCustomerId>

-                   <v201:developerToken>someToken</v201:developerToken>

-                   <v201:userAgent>aName</v201:userAgent>

-                   <v201:validateOnly>false</v201:validateOnly>

-                   <v201:partialFailure>false</v201:partialFailure>

-                </v20:RequestHeader>

-             </soapenv:Header>

-             <soapenv:Body>

-                <v20:mutateMembers>

-                   <v20:operations>

-                      <v201:operator>ADD</v201:operator>

-                      <v201:Operation.Type/>

-                      <v20:operand>

-                         <v20:userListId>aNumber</v20:userListId>

-                         <v20:removeAll>false</v20:removeAll>

-                         <v20:membersList>

-                            <v20:hashedEmail>value</v20:hashedEmail>

-                            <v20:mobileId/>

-                            <v20:hashedPhoneNumber/>

-                            <v20:addressInfo>

-                               <v20:hashedFirstName>value</v20:hashedFirstName>

-                               <v20:hashedLastName>value</v20:hashedLastName>

-                               <v20:countryCode/>

-                               <v20:zipCode>value</v20:zipCode>

-                            </v20:addressInfo>

-                            <v20:userId/>

-                         </v20:membersList>

-                         <v20:membersList>

-                            <v20:hashedEmail>value</v20:hashedEmail>

-                            <v20:mobileId/>

-                            <v20:hashedPhoneNumber/>

-                            <v20:addressInfo>

-                               <v20:hashedFirstName>value</v20:hashedFirstName>

-                               <v20:hashedLastName>value</v20:hashedLastName>

-                               <v20:countryCode/>

-                               <v20:zipCode>value</v20:zipCode>

-                            </v20:addressInfo>

-                            <v20:userId/>

-                         </v20:membersList>

-                      </v20:operand>

-                   </v20:operations>

-                </v20:mutateMembers>

-             </soapenv:Body>

-          </soapenv:Envelope>

 

 

-          Response for the call without the authorization token 

  •  

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

   <soap:Header>

      <ns2:ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/rm/v201710" xmlns="https://adwords.google.com/api/adwords/cm/v201710">

         <requestId>000562fdc1c2db300a813252960a78e3</requestId>

         <serviceName>AdwordsUserListService</serviceName>

         <methodName>mutateMembers</methodName>

         <operations>1</operations>

         <responseTime>195</responseTime>

      </ns2:ResponseHeader>

   </soap:Header>

   <soap:Body>

      <soap:Fault>

         <faultcode>soap:Client</faultcode>

         <faultstring>[AuthenticationError.LOGIN_COOKIE_REQUIRED @ ; trigger:'&lt;null>']</faultstring>

         <detail>

            <ns2:ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201710" xmlns:ns2="https://adwords.google.com/api/adwords/rm/v201710">

               <message>[AuthenticationError.LOGIN_COOKIE_REQUIRED @ ; trigger:'&lt;null>']</message>

               <ApplicationException.Type>ApiException</ApplicationException.Type>

               <errors xsi:type="AuthenticationError" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                  <fieldPath/>

                  <trigger>&lt;null></trigger>

                  <errorString>AuthenticationError.LOGIN_COOKIE_REQUIRED</errorString>

                  <ApiError.Type>AuthenticationError</ApiError.Type>

                  <reason>LOGIN_COOKIE_REQUIRED</reason>

               </errors>

            </ns2:ApiExceptionFault>

         </detail>

      </soap:Fault>

   </soap:Body>

</soap:Envelope>

 

-          Response for the call with the authorization token

 

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

   <soap:Header>

      <ns2:ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/rm/v201710" xmlns="https://adwords.google.com/api/adwords/cm/v201710">

         <requestId>000562fde5c725b80a8105c5b00ce79e</requestId>

         <serviceName>AdwordsUserListService</serviceName>

         <methodName>mutateMembers</methodName>

         <operations>1</operations>

         <responseTime>36</responseTime>

      </ns2:ResponseHeader>

   </soap:Header>

   <soap:Body>

      <soap:Fault>

         <faultcode>soap:Client</faultcode>

         <faultstring>[AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'&lt;null>']</faultstring>

         <detail>

            <ns2:ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201710" xmlns:ns2="https://adwords.google.com/api/adwords/rm/v201710">

               <message>[AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'&lt;null>']</message>

               <ApplicationException.Type>ApiException</ApplicationException.Type>

               <errors xsi:type="AuthenticationError" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                  <fieldPath/>

                  <trigger>&lt;null></trigger>

                  <errorString>AuthenticationError.OAUTH_TOKEN_INVALID</errorString>

                  <ApiError.Type>AuthenticationError</ApiError.Type>

                  <reason>OAUTH_TOKEN_INVALID</reason>

               </errors>

            </ns2:ApiExceptionFault>

         </detail>

      </soap:Fault>

   </soap:Body>

</soap:Envelope>


Can someone tell me how use this Authorization : Bearer YOUR_ACCESS_TOKEN?


Thanks everyone

Peter Oliquino

unread,
Mar 9, 2018, 1:30:13 AM3/9/18
to AdWords API Forum
Hi German,

Could you confirm if you have completed the steps mentioned in this guide and was able to generate the refreshToken? If yes, could you also confirm if you are using the client libraries and storing the credentials in the property file? I asked because if you are using any of the client libraries of the AdWords API and have stored all the credentials in the property/configuration file, the accessToken should be automatically generated/renewed and you should no longer need to input them manually.

Also since you are using the SOAP UI, then, there would be no way for you to include the authorization URL as this is generated in the back end and passed automatically in the request. However, if you still wish to use other means aside from the client libraries, you will need to implement your own OAuth2 flow by referring to this guide.

Best regards,
Peter
AdWords API Team

Germán Darío Ruiz

unread,
Mar 9, 2018, 10:11:03 AM3/9/18
to AdWords API Forum
Thank you for replying I will try again and you will receive news from me
Reply all
Reply to author
Forward
0 new messages