- Get an application client ID
- Request an OAuth token
- Send requests to Google Maps Coordinate API
The Google Maps Coordinate API uses OAuth 2.0 for authentication. Please read Using OAuth 2.0 to Access Google APIs for details.
The Google Maps Coordinate API supports the following OAuth 2.0 authorization scenarios:
- Web server, for making authenticated requests from the browser.
- Installed app, for native applications.
Get an application client ID
Note that an OAuth 2.0 'application client ID' is not the same as a 'Google Maps API for Business client ID'.
Obtain a client ID, of type 'web application' or 'installed application', by creating a project in the Google APIs Console:
- Create a project in the Google APIs Console.
- Click API Access in the left-hand navigation panel on the Google APIs Console.
- Select your project from the project drop-down at the top left.
- Click Create an OAuth 2.0 client id (or Create another client ID).
- Select the application type: web application or
- A web application requires an HTTP endpoint that will receive the authorization codes resulting from the OAuth 2.0 authorization flow.
- An installed application does not require such an HTTP endpoint. Instead, the user will be presented with the authorization code that they can copy/paste in your application settings.
- Enter your site or hostname, to complete the configuration.
- Click Create client ID. Your new client ID will appear on the API Access tab, along with the client secret, the default redirect URI, and other information.
- If you want to change the redirect URI and other settings, click Edit settings. The redirect URI is the page that Google will send users to after they have granted your application access.
Request an OAuth token
The next step is for your application to obtain an OAuth access token that grants access to the Coordinate API.
You may grant one of two levels of access to a user: read-only, or read/write. These are defined using a scope parameter in the authentication request:
https://www.googleapis.com/auth/coordinate: Grants read and write access to the user.
https://www.googleapis.com/auth/coordinate.readonly: Grants read-only access to the user.
Google supplies OAuth 2.0 client libraries to support API authentication, as described in Using OAuth 2.0 to Access Google APIs. The client libraries take care of communication with the authorization servers, storage of the access and refresh tokens, and negotiation of new tokens. Libraries are available for a number of languages, including Java, PHP, and Python.
You will need the following pieces of information when using a client library:
- The OAuth scope.
- Your client ID.
- Your client secret.
- The redirect URI.
Send requests to Google Maps Coordinate API
Once you've successfully authenticated, you can start sending requests to the Google Maps Coordinate API.
Requests to the API must be accompanied by an OAuth access token as the value
POST https://www.googleapis.com/coordinate/v1/teams/team_id/jobs Authorization: Bearer ya29.AHES6ZQY34C3TTHkZr0sm1zntv2exa80xd1yZlvD3qwwe5aqmA2ZJw