# 工作筆記 #5 - 第三方登入(2)_Google 需求 --- > 將登入功能加入使用 Google 登入 <br /> 前置作業 --- > 申請 Google 憑證 ### 1. 到 [ Google Cloud Platform 首頁 ](https://console.cloud.google.com/apis/dashboard) <br /> ### 2. 新建立一個新專案 ![](https://i.imgur.com/sgAJKJM.png) <br /> ### 3. 左邊選單點選 [程式庫],搜尋 [google people api],並啟用 api ![](https://i.imgur.com/EUseOUq.png) ![](https://i.imgur.com/3JrWBGs.png) <br /> ### 4. 建立 [ OAuth 同意畫面 ] * 點選 [ OAuth 同意畫面 ] ![](https://i.imgur.com/8fVSFWp.png) * 填寫應用程式資訊與開發人員聯絡資訊 ![](https://i.imgur.com/utZvDZD.png) ![](https://i.imgur.com/RniCBci.png) <br /> ### 5. 建立 [ OAuth 用戶端 ID ] * 點選 [ OAuth 用戶端 ID ] ![](https://i.imgur.com/kdbTb29.png) * 填寫資料 ![](https://i.imgur.com/mfKirkV.png) ![](https://i.imgur.com/oKDD6Fc.png) * 完成,取得用戶端 ID ![](https://i.imgur.com/tLofHDc.png) <br /> 程式說明 --- > 使用 Google API ``` <script> function HandleGoogleApiLibrary() { gapi.load('client:auth2', { callback: function () { gapi.client.init({ clientId: Google_appId, scope: 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/plus.me' }); }, onerror: function () { console.log("Failed to load libraries"); } }); } </script> <script async defer src="https://apis.google.com/js/api.js" onload="this.onload=function(){};HandleGoogleApiLibrary()" onreadystatechange="if (this.readyState === 'complete') this.onload()"></script> ``` <br /> ###### tags: `login` `google` `第三方登入` --- 參考資料 > https://dotblogs.com.tw/shadow/2019/10/11/030306