diff --git a/README.md b/README.md index c84dafaf..31decf09 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ | Build | [![CircleCI](https://circleci.com/gh/Opteo/google-ads-node.svg?style=shield&circle-token=ab3cda2c83e0a13712c96c088871e16ead2b78c7)](https://circleci.com/gh/Opteo/google-ads-node) | | Release | ![Release](https://img.shields.io/github/release/opteo/google-ads-node.svg) | -This library is a minimal, low-level implementation for calling the Google Ads API with gRPC Protocol Buffers. For a more feature complete and easier to use library, try our [Javascript client library](https://github.com/opteo/google-ads-api). +**Note:** This library is a minimal, low-level implementation for calling the Google Ads API with gRPC Protocol Buffers. For a more feature complete and easier to use library, try our [Javascript client library](https://github.com/opteo/google-ads-api). ## Features - Fully matches the lastest [Google Ads API documentation](https://developers.google.com/google-ads/api/reference/rpc/) @@ -79,6 +79,31 @@ example(); ``` +## Usage + +### Authentication + +#### 1. No internal authentication +A valid Google Ads `access_token` must be provided. This usage depends on the `access_token` being refreshed and generated outside of the client. If the token isn't valid, an `UNAUTHENTICATED` error will be thrown. It's recommended to follow the [instructions here for generating tokens](https://developers.google.com/google-ads/api/docs/oauth/overview). +```javascript +const client = new GoogleAdsClient({ + developer_token: "", + access_token: "", +}); +``` + +#### 2. Token generation and refresh handling +This approach, which is recommended, internally handles access token generation and refreshing. A valid `client_id`, `client_secret` and `refresh_token` must be provided. +```javascript +const client = new GoogleAdsClient({ + client_id: "", + client_secret: "", + refresh_token: "", + developer_token: "", +}); +``` + + ## Contributing ### Protocol Buffers