java如何在Android中进行一次点击登录和注册
这是我在谷歌开发者页面上的代码
signInRequest = BeginSignInRequest.builder()
.setPasswordRequestOptions(BeginSignInRequest.PasswordRequestOptions.builder()
.setSupported(true)
.build())
.setGoogleIdTokenRequestOptions(BeginSignInRequest.GoogleIdTokenRequestOptions.builder()
.setSupported(true)
// Your server's client ID, not your Android client ID.
.setServerClientId(getString(R.string.server_id))
// Only show accounts previously used to sign in.
.setFilterByAuthorizedAccounts(true)
.build())
.build();
oneTapClient.beginSignIn(signInRequest)
.addOnSuccessListener(this, new OnSuccessListener<BeginSignInResult>() {
@Override
public void onSuccess(BeginSignInResult result) {
try {
startIntentSenderForResult(
result.getPendingIntent().getIntentSender(), REQ_ONE_TAP, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
Log.e(TAG, "Couldn't start One Tap UI: " + e.getLocalizedMessage());
}
}
})
.addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// No saved credentials found. Launch the One Tap sign-up flow, or
// do nothing and continue presenting the signed-out UI.
Log.d(TAG, e.getLocalizedMessage());
}
});
我正在我的Android应用程序中实现一次点击登录和注册,我还在Google API控制台中创建了一个项目,并在这里提到了客户端ID,但上面的代码不起作用
我已经搜索了一些示例项目,但不可用,而且一个用于逐步代码流的示例YouTube视频也不可用。下一步我能试试什么
# 1 楼答案
日志会有所帮助,尽管我猜这是个例外:
在代码更改中
到