How to Generate Google API key

How to Generate Google API key

The Google API key is a unique identifier that authenticates requests associated with your project for usage and billing purposes. You must have at least one API key associated with your project. Getting the Google API key is quite an easy process. If you need to connect to services such as Google Drive or Google Maps from your website or another remote server, you will need a Google API key. 

What is the Google API key used for?

This topic shows how application developers can use API keys with Google Cloud APIs. An API key is a simple encrypted string that identifies an application in the absence of a principal. They are useful for anonymously accessing public data and for associating API requests with your project for quota and billing.

How is API key generated?

The API key for accessing the APIs in that product is generated when the app is registered with the API product. A string containing permission information that a client-side software can use to access the API product’s resources. When a registered app is linked to an API product, the API key is generated.

Steps to create Google API key

Step 1: First, you will need to log into the Google Developers Console.

Google API keys

Step 2: Once on your Google Developers Console, create a new project. To do so, click the Create Project button on the top left.

Step 3: Once the button is clicked, enter a project name. You may use the project ID that is already populated for you as this is simply a unique identifier used on Google’s end, or you can create your own. Then, click Create.

Step 3: It can take a few minutes to create the project for you. Once created, you will be taken to that project.

Step 4: From within your new project, click on APIs & auth. You should now see a list of services. Locate the API service that you want to use, and click on OFF to switch it to ON. That API service is now active on your account.

Step 5: Now, you’ll need to generate your API credentials. To do so, click on Credentials on the left side of the page.

Google API keys

Step 6: The information that you need to generate will vary depending on your application that uses the Google API. If you are using a service that will require user authentication such as uploading files to Google Drive, then you will need to create an OAuth Client ID. If you are creating an application that simply relays data from Google such as generating maps with Google Maps, then you will need a Public API Key.

Key generation for OAuth applications

To generate an OAuth Client ID, click on the button that says Create New Client ID. You will then be presented with a popup box that asks for the type of application, as well as authorized JavaScript origins and redirect URI.

Public API key generation

To access services that do not require user authentication, such as Google Maps, you will need to use a public API key. To generate one, click on Create New Key. You will have a few different key options to generate:

Server key: Select this if you will be making API calls from a server.
Browser key: Select this option if you will be making API calls from the user’s browser.
Android key: If the user’s Android phone or tablet will be making the API call, use this option.
iOS key: This option is used for making API calls from an iPhone, iPad, or iPod.

You’ll see your Google API key on the Credentials page now that you’ve generated them. You are now ready to incorporate this information into your application.

More Information

For more information about Google G Suite/Workspace domains, Server, Hosting, check out these F60 Host resources: