我正在通过以下线程将gmail登录到我的android应用程序中:
https://developers.google.com/identity/sign-in/android/sign-in?configured=true
但我犯了错误,因为:
状态{statusCode=DEVELOPER_ERROR,resolution=null}
我在这里查看了这些状态代码文档:
上面的链接无助于诊断问题,
我已经创建了调试密钥库文件&使用keytool生成的SHA-1,也是在控制台中,我添加了包名,就像它在清单文件或gradle文件中一样。
但是,似乎一切都失败了,谁能告诉我,这个错误代码意味着什么可能出错?
发布于 2016-10-24 06:08:57
问题是SHA1错配,
1]第一个关键文件: i解决了错误,问题是在构建Android时,采用了位于C:\Users\<LOGGED_IN_USER_NAME>\.android\debug.keystore
内部的默认密钥存储文件
2]第二个密钥库文件:,我还创建了另一个密钥存储库文件,位于不同的目录,即app/ Keystore /调试器。
当配置在应用程序i中集成gmail登录时,给出通过上面的第二个密钥存储库文件生成的sha-1密钥,同时使用其他密钥存储库文件构建apk文件时,出现了沙-1键错配的情况。
为了获取位于@ app/keystore/debug.keystore
的keystore文件,我使用以下代码在应用程序级别配置了gradle文件:
signingConfigs {
debug {
storeFile file('keystore/debug.keystore')
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
}
/*
release {
storeFile file('release.keystore')
storePassword "mystorepassword"
keyAlias "mykeyalias"
keyPassword "mykeypassword"
}
*/
现在,生成的apk 1签名与在google控制台上为您的应用程序配置的沙-1键匹配。
注意:始终使用debug.keystore调试gmail集成(在开发时)。
参考文献:
用于gmail集成:https://developers.google.com/identity/sign-in/android/start-integrating
要查看在应用程序中使用了哪些sha-1,请参阅堆栈溢出线程:沙-1密钥库证书指纹。
发布于 2017-12-30 05:40:55
对于正在使用反应本地谷歌信号和Firebase的任何人,请尝试以下操作。
步骤1:获取Android开发人员Debug Keystore的SHA-1。
keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore
密码是android
。复制SHA-1值,该值在输出中如下所示:
Certificate Fingerprints
....
SHA1: aa:bb:cc:dd:ee:ff:11:22:33:44:47:D0:9E:8D:E0:0C:79:F1:0F:CB
步骤2:在Firebase控制台中将SHA添加到Android应用程序
现在,在Firebase控制台中打开Android应用程序并添加SHA-1:
发布于 2019-03-07 08:55:49
对于react本地应用程序google登录,我遵循了以下步骤,它成功了。
GoogleSignin.configure({
iosClientId: Constants.GOOGLE_LOGIN_CLIENT_ID_IOS,
webClientId: Constants.GOOGLE_WEB_CLIENT_ID,
offlineAccess: false
});
或者您可以创建这样一个单独的方法,并在componentDidMount中调用它来配置GoogleSignIn
async setupGoogleSignin() {
try {
await GoogleSignin.hasPlayServices//({ autoResolve: true });
await GoogleSignin.configure({
iosClientId: Constants.GOOGLE_LOGIN_CLIENT_ID_IOS,
webClientId: Constants.GOOGLE_WEB_CLIENT_ID,
offlineAccess: true
});
const user = await GoogleSignin.currentUserAsync();
console.log("user from google sin in", user);
} catch (err) {
console.log("Google signin error", err.code, err.message);
}
}
配置GoogleSignIn之后,您可以在GoogleSignInButton按下调用以下方法
googleAuth() {
GoogleSignin.signIn()
.then(user => {
console.log("user==", user);
console.log("user name = ", user.user.email);
console.log("accessTOken = ", user.accessToken);
this.props.socialMediaLogin( // this is my method that I call on successful authentication
user.user.id,
user.user.name,
user.user.givenName,
user.user.familyName,
user.user.email,
user.user.photo,
"GOOGLE",
user.accessToken
);
})
.catch(err => {
console.log("WRONG SIGNIN", err);
})
.done();
}
https://stackoverflow.com/questions/40088741
复制相似问题