我正在尝试实现 SMS Retriever API 以进行 SMS 验证。文档中提到的官方方式说GoogleApiClient与HintRequest从设备检索手机号码一起使用
HintRequest hintRequest = new HintRequest.Builder()
.setPhoneNumberIdentifierSupported(true)
.build();
PendingIntent intent = Auth.CredentialsApi.getHintPickerIntent(
googleApiClient, hintRequest);
try {
startIntentSenderForResult(intent.getIntentSender(),
RESOLVE_HINT, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但是GoogleAPIClient已弃用并由GoogleApi接口代替,例如GoogleSignInClient. 我尝试使用GoogleSignInClient但getHintPickerIntent不接受。即使在被弃用后使用旧 API 是否安全,或者有没有办法将后者与 SMSRetriver API 一起使用?
android google-api google-api-client googlesigninapi sms-retriever-api
将要崩溃的行:
GoogleSignInAccount googleUser = await _googleSignIn.signIn();
Run Code Online (Sandbox Code Playgroud)
我试过什么:
keytool -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystoredebug.keystore从.android到MyProject/android添加到android/build.gradle这些行中:
添加到android/app/build.gradle这一行:
release-signing.properties在我的项目文件夹下创建一个文件,其中包含这些行。
另外,我已经在所有 StackOverflow问题中搜索了我能找到的这个问题,但没有一个对我有用。
我的 pubspec.yaml:
firebase_core: ^0.4.0+1
firebase_analytics: ^3.0.1
cloud_firestore: ^0.11.0+2
firebase_auth: ^0.11.1
google_sign_in: ^4.0.1+3
rxdart: ^0.22.0
Run Code Online (Sandbox Code Playgroud)
认证类:
class AuthService {
final GoogleSignIn …Run Code Online (Sandbox Code Playgroud) dart google-signin flutter googlesigninaccount googlesigninapi
编译错误:
Error:(xx, xx) error: package com.google.android.gms.auth does not exist
Error:(xx, xx) error: cannot find symbol variable GoogleAuthUtil
Run Code Online (Sandbox Code Playgroud) android google-play-services google-plus-signin google-signin googlesigninapi
我已按照https://developers.google.com/上的指南操作,我可以在用户登录后获取已登录用户的Google ID令牌.但我注意到令牌将在1小时后过期.我找不到任何官方参考资料,告诉我如何处理过期的Google ID令牌,因此我只能要求用户再次点击Google登录按钮.
如何在旧版ID令牌过期后刷新有效的Google ID令牌,而不会打扰用户一次又一次地手动登录?
我想要为了登录用户我必须使用这段代码:
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
Run Code Online (Sandbox Code Playgroud)
注销
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
disconnect();
}
});
Run Code Online (Sandbox Code Playgroud)
但是当用户重新启动应用程序并且他已经登录(之前没有退出)是否可以检测到这个"当前登录"状态?
显然,可以将"登录"保存在应用程序的设置(共享首选项)中,但是可以使用google api进行检测吗?
android google-api-client android-googleapiclient google-signin googlesigninapi
我正在使用OAuth 2.0 for google SingIn,它正在打开一个用户身份验证的弹出窗口,但我想在同一个标签中打开,请帮助我.提前致谢.
google-api google-authentication google-signin googlesigninaccount googlesigninapi
我正在按照 Android 版 Google 登录指南 ( https://developers.google.com/identity/sign-in/android/backend-auth ) 上的说明操作,我正在尝试验证我的 ID 令牌。当我在浏览器中访问
https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=XYZ123时(其中 XYZ123 是我使用检索的 id 令牌
String idToken = acct.getIdToken();,我得到以下响应:
{
"error_description": "Invalid Value"
}
Run Code Online (Sandbox Code Playgroud)
我的 id 令牌以 eyJ 开头,长度为 1038 个字符。
我也试过这里的解决方案Android : Google Sign-in Invalid token无济于事。
任何帮助,将不胜感激。
我试图按照此文档与Google登录集成,但我在控制台中遇到此错误:
Uncaught TypeError: Cannot read property 'load' of undefined
at script.js:1
script.js:
window.gapi.load('auth2', function() {
console.log('Loaded!');
});
Run Code Online (Sandbox Code Playgroud)
我在大约一半时间内收到错误,并检查Chrome中的网络面板,只有在未加载以下资源时才会发生错误:
https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en.d2dliHDvPwE.O/m=auth2/exm=signin2/rt=j/sv=1/d=1/ed=1/am=AQ/rs=AGLTcCNGAKhVlpzmTUpjFgzBXLpLM_oEFg/cb=gapi.loaded_1
如何消除此错误?
如果它有用,这是我的index.html:
<!DOCTYPE html>
<html>
<head>
<title>Google Sign In Test</title>
<meta name="google-signin-client_id" content="*****.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
<script src="script.js" async defer></script>
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 接近认证的最后阶段,但是handleSignInResult方法出了点问题。它在日志中返回异常代码10(开发人员错误)。Google提供了全面的描述:
应用程序配置错误。该错误不可恢复,将被视为致命错误。开发者是个白痴...
我该怎么办(获取帐户)并最终从帐户中检索值?
预先感谢您的帮助!!!
主要活动:
package ru.podgorny.carcall;
import ...
public class MainActivity extends AppCompatActivity {
SignInButton signInButton;
public static final int RC_SIGN_IN = 07;
public static final String TAG = "MainActivity";
TextView tw1;
TextView tw2;
GoogleSignInOptions gso;
GoogleSignInClient mGSC;
@Override
protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.d(TAG, "Activity Works");
findViews();
gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
//.requestProfile()
.build();
mGSC = GoogleSignIn.getClient(this, gso); //smth with mGSC variable....
View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) { …Run Code Online (Sandbox Code Playgroud) java android google-signin googlesigninaccount googlesigninapi
我想集成一个自动登录弹出窗口,如https://www.lequipe.fr 中显示的那样
它会在浏览器中检测您的会话并询问您是否要使用您的 Google 帐户加入。
我怎样才能在我的网站上实现这一点?(我已经有 Google 登录) - 正在使用 GAPI API?
谢谢