Setting up the Google PubSub Environment

The Google Pub/Sub connector allows you to access the Google Cloud Pub/Sub API Version v1 through WSO2 EI.

To work with the Google Pub/Sub connector, you need to have a Google Cloud Platform account. If you do not have a Google Cloud Platform account, go to console.cloud.google.com, and create a Google Cloud Platform trial account.

Google Pub/Sub uses the OAuth 2.0 protocol for authentication and authorization. All requests to the Google Cloud Pub/Sub API must be authorized by an authenticated user. For information on how to obtain authentication and authorization user credentials, see the following section.

Obtaining user credentials

Follow the steps below to generate user credentials.

Obtaining a client ID and client secret

  1. Go to https://console.developers.google.com/projectselector/apis/credentials, and sign in to your Google account.

    Google pubsub-credentials-page

  2. If you do not already have a project, you create a new project, click Create credentials and then select OAuth client ID.

    Select OAuth client ID

  3. Next, select Web Application, and create a client.

    Select web application

  4. Add https://developers.google.com/oauthplayground as the redirect URL under Authorized redirect URIs, and then click Create. This displays the client ID and client secret.

    Authorization-redirect-URI

  5. Make a note of the client ID and client secret that is displayed, and then click OK.

    Authorization-redirect-URI

  6. Click Library on the left navigation pane.

    Select library

  7. Search Google Cloud Pub/Sub API under the Big data or Networking category.

    Pubsub API

  8. Click Enable. This enables the Google Cloud Pub/Sub API.

    Pubsub enable API

Obtaining an access token and refresh token

  1. Navigate to OAuth playground, click the gear icon on the top right corner of the screen, and select Use your own OAuth credentials.

    playground-credentials

  2. Specify the client ID and client secret that you obtained in step 3 above, and click Close.

  3. Under Step 1 on the screen, select Google Cloud Pub/Sub API from the list of APIs, and select all the scopes that are listed down under Google Cloud Pub/Sub API.

    Authorize API

  4. Click Authorize APIs. This requests for permission to access your profile details.

  5. Click ALLOW.

  6. In Step 2 on the screen, click Exchange authorization code for tokens to generate and view the access token and refresh token.

    Exchange-authorization-code

Top