Skip to content

Commit 2eea44f

Browse files
author
Justin Poehnelt
authored
docs: minimize mention of client id and link api key docs (#659)
1 parent dfa74fa commit 2eea44f

2 files changed

Lines changed: 6 additions & 52 deletions

File tree

README.md

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,11 @@ contribute, please read [How to Contribute][contrib].
6363
- A Google Maps API key.
6464

6565
### API keys
66+
Each Google Maps Web Service request requires an API key. API keys are generated in the 'Credentials' page of the 'APIs & Services' tab of Google Cloud console.
6667

67-
Each Google Maps Web Service request requires an API key or client ID. API keys
68-
are freely available with a Google Account at
69-
[developers.google.com/console](https://developers.google.com/console). The
70-
type of API key you need is a **Server key**.
71-
72-
To get an API key:
73-
74-
1. Visit [developers.google.com/console](https://developers.google.com/console)
75-
and log in with a Google Account.
76-
1. Select one of your existing projects, or create a new project.
77-
1. Enable the API(s) you want to use. The Java Client for Google Maps Services
78-
accesses the following APIs:
79-
- Directions API
80-
- Distance Matrix API
81-
- Elevation API
82-
- Geocoding API
83-
- Maps Static API
84-
- Places API
85-
- Roads API
86-
- Time Zone API
87-
1. Create a new **Server key**.
88-
1. If you'd like to restrict requests to a specific IP address, do so now.
89-
90-
For guided help, follow the instructions for the [Directions API][directions-key].
91-
You only need one API key, but remember to enable all the APIs you need.
92-
For even more information, see the guide to [API keys][apikey].
93-
94-
**Important:** This key should be kept secret on your server.
68+
For even more information on getting started with Google Maps Platform and generating/restricting an API key, see [Get Started with Google Maps Platform](https://developers.google.com/maps/gmp-get-started) in our docs.
69+
70+
Important: This key should be kept secret on your server.
9571

9672
## Installation
9773

@@ -167,24 +143,6 @@ Gson gson = new GsonBuilder().setPrettyPrinting().create();
167143
System.out.println(gson.toJson(results[0].addressComponents));
168144
```
169145

170-
Below is the same example, using client ID and client secret (digital signature)
171-
for authentication. This code assumes you have previously loaded the `clientID`
172-
and `clientSecret` variables with appropriate values.
173-
174-
For a guide on how to generate the `clientSecret` (digital signature), see the
175-
documentation for the API you're using. For example, see the guide for the
176-
[Directions API][directions-client-id].
177-
178-
```java
179-
GeoApiContext context = new GeoApiContext.Builder()
180-
.enterpriseCredentials(clientID, clientSecret)
181-
.build();
182-
GeocodingResult[] results = GeocodingApi.geocode(context,
183-
"1600 Amphitheatre Parkway Mountain View, CA 94043").await();
184-
Gson gson = new GsonBuilder().setPrettyPrinting().create();
185-
System.out.println(gson.toJson(results[0].addressComponents));
186-
```
187-
188146
The `GeoApiContext` is designed to be a [Singleton](https://en.wikipedia.org/wiki/Singleton_pattern)
189147
in your application. Please instantiate one on application startup, and continue to use it for the
190148
life of your application. This will enable proper QPS enforcement across all of your requests.
@@ -230,11 +188,6 @@ To alter or disable automatic retries, see these methods in `GeoApiContext`:
230188
- `.retryTimeout()`
231189
- `.setIfExceptionIsAllowedToRetry()`
232190

233-
### Client IDs
234-
235-
Google Maps APIs Premium Plan customers can use their [client ID and secret][clientid] to
236-
authenticate, instead of an API key.
237-
238191
### POJOs
239192

240193
Native objects for each of the API responses.

src/main/java/com/google/maps/GeoApiContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ public Builder apiKey(String apiKey) {
412412
}
413413

414414
/**
415-
* Sets the ClientID/Secret pair to use for authorizing requests.
415+
* Sets the ClientID/Secret pair to use for authorizing requests. Most users should use {@link
416+
* #apiKey(String)} instead.
416417
*
417418
* @param clientId The Client ID to use.
418419
* @param cryptographicSecret The Secret to use.

0 commit comments

Comments
 (0)