Ask Your Question
1

OAuth 2.0 with Google AdWords

asked 2018-10-01 04:29:26 -0600

Alexander gravatar image

updated 2018-10-02 02:22:33 -0600

Hi,

I have been trying to connect StreamSets with Google AdWords and I am encountering some issues regarding the OAuth 2.0 Authentication. I have found a workaround, using the manual authorization tokens. In that case, I put the Authorization:Bearer token in the request header.

If I want to use OAuth2.0 however, it should refresh the tokens automatically this is what I want to implement. My request body looks as the following:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://adwords.google.com/api/adwords/cm/v201809">
   <soapenv:Header>
      <v20:RequestHeader>
         <!--Optional:-->
         <v20:clientCustomerId>XXX-XXX-XXXX</v20:clientCustomerId>
         <!--Optional:-->
         <v20:developerToken>XXXXXXXXXXXXXXXX</v20:developerToken>
         <!--Optional:-->
         <v20:userAgent>example.com:ReportDownloader:V7.18</v20:userAgent>
         <!--Optional:-->
         <v20:validateOnly>false</v20:validateOnly>
         <!--Optional:-->
         <v20:partialFailure>false</v20:partialFailure>
      </v20:RequestHeader>
   </soapenv:Header>
   <soapenv:Body>
      <v20:get>
         <!--Optional:-->
         <v20:serviceSelector>
            <!--Zero or more repetitions:-->
            <v20:fields>Id</v20:fields>
            <v20:fields>Name</v20:fields>
            <v20:fields>Status</v20:fields>
            <v20:fields>ServingStatus</v20:fields>
            <v20:fields>StartDate</v20:fields>
          <v20:fields>EndDate</v20:fields>
          <v20:fields>AdvertisingChannelType</v20:fields>
          <v20:fields>CampaignTrialType</v20:fields>
          <v20:fields>BaseCampaignId</v20:fields>
          <v20:fields>Labels</v20:fields>
            <!--Zero or more repetitions:-->
            <v20:predicates>
               <!--Optional:-->
               <v20:field>Status</v20:field>
               <!--Optional:-->
               <v20:operator>EQUALS</v20:operator>
               <!--Zero or more repetitions:-->
               <v20:values>ENABLED</v20:values>
            </v20:predicates>
            <!--Optional:-->
            <v20:dateRange>
               <!--Optional:-->
               <v20:min>20180927</v20:min>
               <!--Optional:-->
               <v20:max>20180928</v20:max>
            </v20:dateRange>
            <!--Zero or more repetitions:-->
            <v20:ordering>
               <!--Optional:-->
               <v20:field>Name</v20:field>
               <!--Optional:-->
               <v20:sortOrder>ASCENDING</v20:sortOrder>
            </v20:ordering>
            <!--Optional:-->
            <v20:paging>
               <!--Optional:-->
               <v20:startIndex>0</v20:startIndex>
               <!--Optional:-->
               <v20:numberResults>50</v20:numberResults>
            </v20:paging>
         </v20:serviceSelector>
      </v20:get>
   </soapenv:Body>
</soapenv:Envelope>

For a screenshot of my OAuth2 settings:

image description

Does anyone know how to resolve this issue? I have no validation errors, but no records come out of the pipelines while it is running.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-10-05 04:39:27 -0600

Alexander gravatar image

In the end, I could not get the OAuth2.0 feature working, but meanwhile found a workaround for it. For Google OAuth2.0, it is also possible to generate a refresh_token, which is re-usable to generate a temporary access token which is valid for 60 minutes.

I put a shell executor in another pipeline, which executes a curl command to put the token somewhere on the server. It is put in the 'apps/ss/ss-dc/resources' folder so in that case the server doesn't need to be restarted to fetch the newest value of the access token:

image description

At last, in the original pipeline where we are calling the AdWords API, we refer to the location where the access token is located. The access token is automatically updating every 50 minutes.

image description

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-10-01 04:29:26 -0600

Seen: 61 times

Last updated: Oct 05