This document describes the steps you need to start using the Navigation Connect.
|
Check that you meet the prerequisites. |
Turn on the API in your Google Cloud project. |
Configure OAuth to make an authenticated API request. |
Google Maps Platform products require API calls to include an OAuth token to prevent unauthorized use.
Create an OAuth token
Navigation Connect supports OAuth 2.0 for authentication. Google supports common OAuth 2.0 scenarios, such as scenarios for a web server.
This document describes how to pass an OAuth token to a Navigation Connect call in your development environment. For more information about using OAuth in a production environment, see Authentication methods at Google.
You can call Google Maps APIs directly by making API requests to the server, or you can use client libraries to simplify your code. Google Maps provides client libraries for Go, Java, Node.js, and Python. For more information, see Navigation Connect client libraries.
OAuth overview
You can create and manage access tokens with OAuth in several ways depending on your deployment environment.
You can use OAuth 2.0 for server-to-server interactions between your application and a Google service. For this scenario, you use a service account that's associated with your application rather than an individual user. You can make API requests using the service account without involving users directly. For more information about authentication methods, see Authentication methods at Google.
Alternatively, you can integrate Navigation Connect into an Android or iOS mobile app. For more information about using OAuth and managing access tokens for different deployment environments, see Using OAuth 2.0 to Access Google APIs.
OAuth scopes
To use OAuth with Navigation Connect, you must assign the OAuth token the following scope:
https://www.googleapis.com/auth/cloud-platform
Example: Try REST API calls in your local development environment
If you don't have an environment that generates tokens and you want to try Navigation Connect with an OAuth token, use the procedure in this section.
This example describes how to use the OAuth token provided by Application Default Credentials (ADC) to make the call. For more information about using ADC to call Google APIs with client libraries, see Authenticate using client libraries.
Use the following REST procedure only for development or testing, not for production.
Prerequisites
Before you make a REST request using ADC, use the gcloud CLI to provide
credentials to ADC:
Install and initialize the
gcloudCLI. For more information, see Install the gcloud CLI.Authenticate with the
gcloudCLI:gcloud auth application-default login
Complete the sign-in process to save your credentials in the local credential file used by ADC.
For more information, see Set up ADC for a local development environment.
Make a REST request
In this example, you pass two request headers:
Pass the OAuth token in the
Authorizationheader by using the following command to generate the token:gcloud auth application-default print-access-tokenThe returned token has a scope of
https://www.googleapis.com/auth/cloud-platform.Pass the ID or name of your Google Cloud project that has billing enabled in the
X-Goog-User-Projectheader.
To call Navigation Connect using an OAuth token, complete the following steps:
In the following code sample, replace the placeholders with your values:
- PROJECT_ID: your Google Cloud project ID
- ANDROID_APP_ID: the Android package name of your app, if applicable
- IOS_APP_ID: the iOS bundle ID of your app, if applicable
#!/bin/bash trip_id="$(uuidgen)" access_token="$(gcloud auth application-default print-access-token)" curl -X POST "https://navigationconnect.googleapis.com/v1/projects/PROJECT_ID/trips?tripId=${trip_id}" \ -H "Authorization: Bearer ${access_token}" \ -H "Content-Type: application/json" \ -d '{ "androidAppId": "ANDROID_APP_ID", "iosAppId": "IOS_APP_ID", }'
To copy the
curlcommand, click Copy in the code sample.Paste the command in a terminal window, and then run it.
The response is a JSON object:
{ "name": "projects/PROJECT_NUMBER/trips/TRIP_ID", "authToken": { "token": "BASE64_ENCODED_TRIP_TOKEN", "expireTime": "2026-03-06T11:09:47.476942Z" }, "state": "NEW", "execution": { "traveledDistanceMeters": 0, "stopAddedInRoute": false }, "createTime": "2026-03-05T23:09:50.768959Z", "updateTime": "2026-03-05T23:09:50.768959Z", }
This response includes the following values:
- PROJECT_NUMBER: the unique long-integer identifier for the project
- TRIP_ID: the UUIDv4 trip ID that your backend generates
- BASE64_ENCODED_TRIP_TOKEN: the authenticated token that the
createTripmethod returns for initiating tracked turn-by-turn navigation in Google Maps or Waze
Troubleshooting
If your request returns an error message stating that this API doesn't support end-user credentials, see Troubleshoot your ADC setup.
What's next
Next, configure your service accounts for Navigation Connect API to support secure, server-to-server communication between your backend infrastructure, Google Maps, and Waze.