Drupal 6

Google supports the OAuth standard for API authentication. By using this module, web applications can access a user's Google Apps account without needing the user's GApps login details. The user logs into the site with their Drupal username and password. Once authenticated, they are then immediately redirected to the Google login page where they must confirm (or reject) that the website is allowed to use an authorization token to access their Google account.

Administrators of Google Apps Premier and Education editions can also use a special type of OAuth, called 2-legged OAuth. Unlike standard OAuth, the user is not actually authenticated with Google, but the site is able to act on their behalf to pull in or update their account data. Currently this authentication is implemented, but no APIs make use of it yet.

For more details, see http://code.google.com/apis/accounts/docs/OAuth.html

To enable OAuth on your domain go to https://www.google.com/accounts/ManageDomains

Recommended reading: Overview of Google authentication methods - This blog post explains the different Google authentication options available and also the Drupal modules which implement them.

Note: Google offers two libraries for handling authentication: one using the OAuth open standard, and a second interface called AuthSub, developed prior to the release of the OAuth standard. The Google Authentication for Web Applications implements AuthSub. This module implements the OAuth interface.

This module depends on the OAuth module.

Drupal 7

Drupal 7 branch allows you to authenticate with google and use this authentication to carry other api requests. This module can help you to manage accounts, authenticate with google (i.e. get access token) and use this authentication to carry api requests in other modules. This module allows you to enter google account details like client id, client secret key, developer key, select google services to be enabled and gets the OAuth2 access token from google. The account manage page also shows a authenticate link if the account is not authenticated (this can be helpful to authenticate later if the account is created by gauth_account_save) and shows a Revoke link if the account is already authenticated and you want to revoke access.

This module is based on google api php client refer https://github.com/google/google-api-php-client

You can refer more at https://developers.google.com/accounts/docs/OAuth2Login#scopeparameter and https://developers.google.com/accounts/docs/OAuth2 for Google OAuth2.
You can manage multiple google account on drupal site and use any of these accounts to carry a request to the google apis in other modules.

Google Account Api Access Configuration
You need to create a client id account at https://code.google.com/apis/console, in api access.
Add your site domain like http://mysite.com and set the redirect url as http://mysite.com/gauth/response_handler

The 7.x-1.7 release is tested with google api php client 2.0.2. This release works only with 2.0 version of the library and don't support prior versions
The 7.x-1.5 release is tested with google api php client 1.1.6.
The 7.x-1.9 is tested with v2.1.0 of google api php client with both package and composer install

You need to patch the library to use offline mode https://github.com/google/google-api-php-client/pull/1103/files more details https://www.drupal.org/node/2797735

Project Information