以下代码在领域文档中提供。
GoogleSignin.configure({
webClientId: clientId,
offlineAccess: true,
});
async function getGoogleAuthCode() {
try {
await GoogleSignin.hasPlayServices();
const {serverAuthCode} = await GoogleSignin.signIn();
return serverAuthCode;
}
catch (error) {}
上面的代码总是返回 10 - DEVELOPER_ERROR,
交叉检查了客户端 ID。由于 mongodb 领域建议使用网络应用程序类型 google oAuth。App 的 SHA 未在 google 端注册。