在capacitor.config.json
"GoogleAuth": {
"scopes": ["profile","email"],
"serverClientId": "KEY.apps.googleusercontent.com"
}
在 index.html 中
<meta name="google-signin-client_id" content="KEY.apps.googleusercontent.com">
在android檔案夾string.xml檔案中
<string name="server_client_id">KEY.apps.googleusercontent.com</string>
并在我們的頁面 .ts 檔案中獲取 google 用戶詳細資訊的詳細資訊
const user = await GoogleAuth.signIn();
我在 android 中有一個錯誤,出了點問題。
任何人都知道如何解決這種情況
uj5u.com熱心網友回復:
您必須在android/app/src/main/java/com/appName/app/MainActivity.java 中添加這些代碼行
package com.growyd.app;
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth;
import com.getcapacitor.Plugin;
import java.util.ArrayList;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//Initialize bridge
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
// Additional plugins you've installed go here
add(GoogleAuth.class);
}});
}
}
在此鏈接中是配置庫的步驟。
我的參考:https : //devdactic.com/capacitor-google-sign-in/
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/356339.html
標籤:javascript 火力基地 离子框架 谷歌API 电容器
