Get Browser Key for Google APIs
What is a Browser Key? And when do you need one?
Browser Key for Google API is needed if your application runs on a client, such as a web browser or mobile app. Browser key can be restricted based on HTTP referrer. Currently, a few APIs like Place API only supports browser and server key even if you are using the API in android or IOS applications.
How to obtain a browser key for Google API?
To use any google API, you need to create a project on Google Developer Console. Once you have created the project you will have to enable the desired API and generate credentials to use the API.
Below is the step-by-step guide to show how you get the browser key for Google APIs:
Step 1: Create a project on Google Developer Console:
To create a project on Google Developer Console, login to the developer console and create a new project by clicking “Select a project” drop down. Then select the “Create a project…” link from the drop down menu, as shown in the picture below:
Once you click on “Create a project…” link, a dialog will appear where you need to input a name for your project.
After giving a name to your project click “Create” button to create a project.
Step 2: Enable Desired API.
Once the project is created you will have to enable the API on Developer Console in order to use it. To enable the API, click on “Enable and manage APIs” link on the Dashboard of the newly created project.
Now, on the landing page click on the desired API link given on the page (you may also search for the desired API) and then click “Enable” button to enable the API.
Step 3: Create Browser Key Credentials to use Google API.
Once you enable the API, you will need to create credentials to use that API. Credentials can be of different types like, an API key, a service account, or an OAuth 2.0 client ID depending upon the API you want to use. For example, to use Place API for Android, you will need to create Browser Key Credentials.
To get a new Browser Key, click on “Credentials” section on the left panel of the console and select “Create Credentials” drop-down link on the credentials page. Then select “API Key” from the drop-down list.
A dialog will appear asking for which type of key you want. Click on “Browser Key” button on the dialog. A “Create browser key” form will appear like shown below:
Give a name to your browser key and add an HTTP referrers (optional) if you want to restrict the use of key based on referrer and then click on the “Create” button.As soon as you click the “Create” button, a new Browser Key will be created. You can then use this key to access Google APIs.
You can use the above given steps to create any type of key. Just select the desired key option on the credentials page and fill in the form fields required to create the key.