我试图将谷歌登录集成到我的应用程序中。我没有后端服务器,我只是得到登录到我的应用程序的谷歌帐户的详细信息。
我第一次尝试使用谷歌登录的例子,但我得到了一个错误(除了打印下面的stacktrace外,没有进行任何代码更改)。我只是使用了signianctivity示例,因为我没有后端服务器。
Exception com.google.android.gms.common.api.ApiException: 12500:
at com.google.android.gms.common.internal.zzb.zzz(Unknown Source)
at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source)
at com.ewise.android.api.MainActivity.onActivityResult(SignInActivity.java:89) at android.app.Activity.dispatchActivityResult(Activity.java:7010)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4187)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4234)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6316)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
密码
public class SignInActivity extends AppCompatActivity implements
View.OnClickListener {
private static final String TAG = "SignInActivity";
private static final int RC_SIGN_IN = 9001;
private GoogleSignInClient mGoogleSignInClient;
private TextView mStatusTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Views
mStatusTextView = findViewById(R.id.status);
// Button listeners
findViewById(R.id.sign_in_button).setOnClickListener(this);
findViewById(R.id.sign_out_button).setOnClickListener(this);
findViewById(R.id.disconnect_button).setOnClickListener(this);
// [START configure_signin]
// Configure sign-in to request the user's ID, email address, and basic
// profile. ID and basic profile are included in DEFAULT_SIGN_IN.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
// [END configure_signin]
// [START build_client]
// Build a GoogleSignInClient with the options specified by gso.
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
// [END build_client]
// [START customize_button]
// Set the dimensions of the sign-in button.
SignInButton signInButton = findViewById(R.id.sign_in_button);
signInButton.setSize(SignInButton.SIZE_STANDARD);
signInButton.setColorScheme(SignInButton.COLOR_LIGHT);
// [END customize_button]
}
@Override
public void onStart() {
super.onStart();
// [START on_start_sign_in]
// Check for existing Google Sign In account, if the user is already signed in
// the GoogleSignInAccount will be non-null.
GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);
updateUI(account);
// [END on_start_sign_in]
}
// [START onActivityResult]
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
// The Task returned from this call is always completed, no need to attach
// a listener.
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
handleSignInResult(task);
}
}
// [END onActivityResult]
// [START handleSignInResult]
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
// Signed in successfully, show authenticated UI.
updateUI(account);
} catch (ApiException e) {
// The ApiException status code indicates the detailed failure reason.
// Please refer to the GoogleSignInStatusCodes class reference for more information.
Log.w(TAG, "signInResult:failed code=" + e.getStatusCode());
e.printStackTrace();
updateUI(null);
}
}
// [END handleSignInResult]
// [START signIn]
private void signIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, RC_SIGN_IN);
}
// [END signIn]
// [START signOut]
private void signOut() {
mGoogleSignInClient.signOut()
.addOnCompleteListener(this, new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
// [START_EXCLUDE]
updateUI(null);
// [END_EXCLUDE]
}
});
}
// [END signOut]
// [START revokeAccess]
private void revokeAccess() {
mGoogleSignInClient.revokeAccess()
.addOnCompleteListener(this, new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
// [START_EXCLUDE]
updateUI(null);
// [END_EXCLUDE]
}
});
}
// [END revokeAccess]
private void updateUI(@Nullable GoogleSignInAccount account) {
if (account != null) {
mStatusTextView.setText(getString(R.string.signed_in_fmt, account.getDisplayName()));
findViewById(R.id.sign_in_button).setVisibility(View.GONE);
findViewById(R.id.sign_out_and_disconnect).setVisibility(View.VISIBLE);
} else {
mStatusTextView.setText(R.string.signed_out);
findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
findViewById(R.id.sign_out_and_disconnect).setVisibility(View.GONE);
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.sign_in_button:
signIn();
break;
case R.id.sign_out_button:
signOut();
break;
case R.id.disconnect_button:
revokeAccess();
break;
}
}
}
从我所读到的,这个问题可能是由SHA1一代引起的。
我遵循了完整的指南,但显然它不起作用。
我从gradle SigningReport复制了SHA1
Variant: debug
Config: debug
Store: /Users/user/.android/debug.keystore
Alias: AndroidDebugKey
MD5: A3:16:3F:43:75:FE:07:62:6D:8D:CC:DD:21:9F:FA:1A
SHA1: 7B:21:26:7F:D8:18:BB:0E:36:1C:82:DD:B7:28:5F:C1:2F:5C:E4:EA
Valid until: Saturday, August 31, 2047
----------
Variant: release
Config: none
----------
Variant: debugAndroidTest
Config: debug
Store: /Users/user/.android/debug.keystore
Alias: AndroidDebugKey
MD5: A3:16:3F:43:75:FE:07:62:6D:8D:CC:DD:21:9F:FA:1A
SHA1: 7B:21:26:7F:D8:18:BB:0E:36:1C:82:DD:B7:28:5F:C1:2F:5C:E4:EA
Valid until: Saturday, August 31, 2047
----------
Variant: debugUnitTest
Config: debug
Store: /Users/user/.android/debug.keystore
Alias: AndroidDebugKey
MD5: A3:16:3F:43:75:FE:07:62:6D:8D:CC:DD:21:9F:FA:1A
SHA1: 7B:21:26:7F:D8:18:BB:0E:36:1C:82:DD:B7:28:5F:C1:2F:5C:E4:EA
Valid until: Saturday, August 31, 2047
可能的原因是什么?
谢谢
另外,这可能是一个原因吗?
Google Play services out of date. Requires 11720000 but found 10932470
检查是否将SHA-1指纹添加到firebase项目设置中。如果没有,请使用查找SHA-1指纹
https://developers.google.com/android/guides/client-auth
此外,找到释放键的SHA-1指纹
keytool -list -v -keystore <keystore path>
删除
然后将SHA-1指纹添加到Firebase项目设置中。
注意:别忘了用新指纹替换更新的google-services.jsongoogle-services.json。我为此浪费了两天时间。
Android studio自动生成
~/。android/debug。在第一次调试生成时使用密钥库
,并使用它对应用程序进行签名。
要运行SHA-1(密码
android
)(doc):
keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore
这个
SHA-1
应该添加到Firebase
的应用设置中,以允许在测试调试构建时使用google登录功能。
错误平台异常(sign_in_failed,com.google.android.gms.common.api.异常: 12500:,空)
通过在“项目设置”中向项目添加支持电子邮件地址,可以解决此12500错误。开放链接https://console.firebase.google.com/
选择项目并打开“设置”选项卡。
提供有效的支持电子邮件并立即重新启动您的应用程序。
当我构建我的应用程序并尝试它时,没有任何错误,但当我在google play store上发布我的应用程序并尝试登录Facebook时,它会给我一个错误。这个错误是一个错误的散列键,因为散列键发生了变化(我得到了sign应用程序的散列键,通过许多方式给了我相同的has键,工作正常)这是第一个问题。 我的第二个问题是当尝试使用gmail登录(谷歌登录)获取字段错误。 (您有错误的OAuth2相关配置
我正在尝试使用我的应用程序中的google帐户登录用户。当用户第一次在我的应用程序中使用google帐户登录时,我遇到了一个问题。它显示了以下错误:传递给Illumb\Auth\Guard::login()的参数1必须实现interface Illumb\Auth\UserInterface,在我的控制器中为空我有以下信息: 我知道问题出在Auth::login($user);因为插入与Auth:
失败:生成失败,出现异常。 > 其中:脚本'C:\src\flutter\包\flutter_tools\gradle\flutter.gradle'行:1035 错误:任务:app:compileFlutterBuildDebug的执行失败。 进程'命令'C:\src\flutter\bin\flutter.bat"以非零退出值1结束 尝试:使用--stack-trace选项运行以获取堆栈跟踪。
我正在尝试使用React原生Google signin插件登录Google,但它给了我一个开发者错误。我所做的与文件中提到的完全相同。这是我的代码和步骤。 1.使用npm安装了react-native-google-signin插件。2.然后用react-native link react-native-Google-sign in 3链接它。之后,我设置了build.gradle文件,正如他们在
我试图登录与谷歌在我的项目。登录页面工作正常,但当我试图获取数据,我得到这个错误。提前谢谢你。 我正在wampserver上运行我的php代码。我正在VisualStudio上编写页面。你可以看到我的代码。 //这是我的谷歌登录代码。php ( ! ) 致命错误:未捕获的GuzzleHttp\Exception\RequestException:cURL错误60:SSL证书问题:无法获取本地颁发者
公共规范。yaml谷歌登录:^4.5。6我面临的错误[error:flatter/lib/ui/ui\u dart\u state.cc(177)]未处理的异常:MissingPluginException(在channel plugins.flatter.io/google\u sign\u上未找到方法init的实现)