看看: http://www.jensbits.com/2012/04/05/google-analytics-reporting-api-using-oauth-2-with-coldfusion/
創建登錄網址和檢索「代碼」 參數登錄URL
客戶端ID和客戶端密鑰是由谷歌設置,當應用程序被註冊爲API訪問Google API控制檯。
重定向uri是用戶在認證後發送到的服務器上的位置。此uri在應用程序註冊期間在Google API控制檯中註冊。
這些數值可以被列入的Application.cfc:
<cfset request.oauthSettings = {scope = "https://www.googleapis.com/auth/analytics.readonly",
client_id = "YOUR-CLIENT-ID.apps.googleusercontent.com",
client_secret = "YOUR-CLIENT-SECRET",
redirect_uri = "YOUR-REDIRECT-URI",
state = "optional"} />
用戶登錄網址
登錄網址將提示用戶是否允許通過的應用程序和一個「代碼來訪問他們的內容谷歌「請求變量將在URL中返回。請參閱形成URL以獲取更多詳細信息。
<!--- create login url --->
<cfset loginURL = "https://accounts.google.com/o/oauth2/auth?scope=" & request.oauthSettings["scope"]
& "&redirect_uri=" & request.oauthSettings["redirect_uri"]
& "&response_type=code&client_id=" & request.oauthSettings["client_id"]
& "&access_type=online" />
登錄與谷歌帳戶訪問分析
你看到這個帖子? [Google oauth token給405錯誤](http://stackoverflow.com/questions/13288949/google-oauth-token-giving-405-error/13289615#13289615)請參閱接受該問題的答案/示例。 –