<p>使用<a href="https://developers.google.com/api-client-library/php/auth/web-app" rel="nofollow noreferrer">OAuth 2.0 for Web Server Applications</a>签出。看来这就是你要找的。在</p>
<blockquote>
<p>Any application that uses OAuth 2.0 to access Google APIs must have
authorization credentials that identify the application to Google's
OAuth 2.0 server. The following steps explain how to create
credentials for your project. Your applications can then use the
credentials to access APIs that you have enabled for that project.</p>
<p>Open the Credentials page in the API Console. Click Create credentials
OAuth client ID. Complete the form. Set the application type to Web application. Applications that use languages and frameworks like PHP,
Java, Python, Ruby, and .NET must specify authorized redirect URIs.
The redirect URIs are the endpoints to which the OAuth 2.0 server can
send responses. For testing, you can specify URIs that refer to the
local machine, such as <a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a>.</p>
<p>We recommend that you design your app's auth endpoints so that your
application does not expose authorization codes to other resources on
the page.</p>
</blockquote>