Stay organized with collections Save and categorize content based on your preferences.
Address Validation API supports the use of OAuth 2.0 for authentication. Google supports common OAuth 2.0 scenarios such as those for a web server.
This document describes how to pass an OAuth token to the Address Validation API call in your development environment. For instructions on using OAuth in a production environment, see Authentication at Google.
Note: While you can use Google Maps APIs directly by making API requests to the server, client libraries provide simplifications that significantly reduce the amount of code you need to write. Google Maps provides client libraries for many programming languages, including Go, Java, Node.js, and Python.See Address Validation API Client Libraries for documentation and examples.
Before you beginBefore you start using the Address Validation API, you need a project with a billing account and the Address Validation API enabled. We recommend creating multiple Project Owners and Billing Administrators, so that you'll always have someone with these roles available to your team. To learn more, see Set up in Cloud Console.
About OAuthThere are many ways to create and manage access tokens with OAuth based on your deployment environment.
For example, the Google OAuth 2.0 system supports server-to-server interactions, such as those between your application and a Google service. For this scenario you need a service account, which is an account that belongs to your application instead of to an individual end user. Your application calls Google APIs on behalf of the service account, so users aren't directly involved. For more information on authentication methods, see Authentication at Google.
Alternatively, you might use the Address Validation API as part of an Android or iOS mobile app. For general information on using OAuth with the Address Validation API, including information on managing access tokens for different deployment environments, see Using OAuth 2.0 to Access Google APIs.
About OAuth scopesTo use OAuth with the Address Validation API, the OAuth token must be assigned the scope:
https://www.googleapis.com/auth/cloud-platform
If you want to try the Address Validation API using an OAuth token, but do not have an environment setup to generate tokens, you can use the procedure in this section to make the call.
This example describes how to use the OAuth token provided by Application Default Credentials (ADC) to make the call. For information about using ADC to call Google APIs using client libraries, see Authenticate using client libraries.
Note: The procedure below to make a REST call is not intended for use in a production environment. Use this procedure for a development or testing environment only. PrerequisitesBefore you can make a REST request using ADC, use the Google Cloud CLI to provide credentials to ADC:
Run the following gcloud
command on your local machine to create your credential file:
gcloud auth application-default login
For more information, see Local development environment section of the Provide credentials for Application Default Credentials documentation.
Make a REST requestIn this example, you pass two request headers:
Pass the OAuth token in the Authorization
header by using the following command to generate the token:
gcloud auth application-default print-access-token
The returned token has a scope of https://www.googleapis.com/auth/cloud-platform.
X-Goog-User-Project
header. To learn more, see Set up in Cloud Console.The following example makes a call to the Address Validation API using an OAuth token:
curl -X POST -d '{ "address": { "regionCode": "US", "locality": "Mountain View", "addressLines": ["1600 Amphitheatre Pkwy"] } }' \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "X-Goog-User-Project: PROJECT_ID" \ "https://addressvalidation.googleapis.com/v1:validateAddress"Troubleshooting
If your request returns an error message about end-user credentials not being supported by this API, see User credentials not working.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-09 UTC."],[[["The Address Validation API utilizes OAuth 2.0 for authentication, supporting common scenarios like those for web servers."],["To use the API, you need a Google Cloud project with billing enabled and the Address Validation API enabled."],["For development purposes, you can use Application Default Credentials (ADC) to make API calls with an OAuth token obtained using the Google Cloud CLI."],["In production environments, refer to Google's authentication documentation for guidance on secure authentication methods."],["The required OAuth scope for using the Address Validation API is `https://www.googleapis.com/auth/cloud-platform`."]]],["The Address Validation API uses OAuth 2.0 for authentication. To use it, you must assign the `https://www.googleapis.com/auth/cloud-platform` scope to the OAuth token. In a development environment, utilize Application Default Credentials (ADC) by running `gcloud auth application-default login` to generate a token. Then, pass this token in the `Authorization` header of a REST request using `gcloud auth application-default print-access-token`, and include your project ID in the `X-Goog-User-Project` header. This is not for production use.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4