Authorization

OAuth 2.0 is used to access Google APIs. It supports server-to-server interactions such as those between a web or native application and a Google service. For this scenario, you need a service account, which is an account that belongs to your application instead of to an individual end user. Your application calls Google APIs on behalf of the service account, so users aren't directly involved.

To begin, you must obtain OAuth 2.0 client credentials from the Google API Console. Your application requests an access token from the Google Authorization Server, extracts a token from the response, and sends the token to the Google API that you want to access.

Then, your application prepares to make authorized API calls by using the service account's credentials to request an access token from the OAuth 2.0 server. Finally, your application can use the access token to call Google APIs.

For more information on OAuth 2.0, see Using OAuth2.0 for server-to-server applications.

Required authorization scope

To access the Communications API, your app must use the following authorization scope: https://www.googleapis.com/auth/nbupaymentsmerchants

Access to the API returned in the response depends on the scope you have requested.

Create service account

  1. Go to API console.
  2. Sign in using your Gmail account.
  3. Create a project.
  4. Create a Service Account, and download a cryptographically signed JSON web token (JWT).

The following image and steps outline interaction between Google's servers and yours:

Your server application uses a JWT to request a token from the Google Authorization Server,
then uses the token to call a Google API endpoint. No end-user is involved.
  1. The merchant server creates a JSON web token (JWT).
  2. Using the JWT app server requests the authorization server (Google server) for a response token.
  3. The Google server responds to the request raised by the app server.
  4. The app server uses the token to call Google API.

You must send an authorization token with every request that requires an OAuth scope. Oauth 2.0 is the supported authorization protocol.