我正在尝试使用React原生Google signin插件登录Google,但它给了我一个开发者错误。我所做的与文件中提到的完全相同。这是我的代码和步骤。
1.使用npm安装了react-native-google-signin插件。2.然后用react-native link react-native-Google-sign in 3链接它。之后,我设置了build.gradle文件,正如他们在文档中提到的那样。
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
googlePlayServicesAuthVersion = "15.0.1"
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.1'
}
allprojects {
repositories {
mavenLocal()
google()
maven {url "https://maven.google.com"}
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
4.更新了android/app/build.gradle,
dependencies {
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation project(':react-native-fbsdk')
compile project(':react-native-vector-icons')
compile project(':react-native-fused-location')
compile project(':react-native-fs')
compile project(':react-native-image-resizer')
compile project(':react-native-geocoder')
compile project(':react-native-device-info')
compile project(':react-native-image-picker')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.facebook.react:react-native:+" // From node_modules
implementation project(":react-native-google-signin")
compile (project(':react-native-maps')){
exclude group: "com.google.android.gms"
}
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-base:15.0.1'
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
5.然后使用android studion debug生成SHA1密钥。密钥存储和生成google服务。firebase中的json文件。
6.然后设置登录.js页面。
async componentDidMount() {
this._configureGoogleSignIn();
}
_configureGoogleSignIn() {
GoogleSignin.configure({
webClientId: '775060548127-5nfj43q15l75va9pfav2jettkha7hm2a.apps.googleusercontent.com',// my clientID
offlineAccess: false
});
}
async GoogleSignin() {
try {
await GoogleSignin.hasPlayServices();
const userInfo = await GoogleSignin.signIn();
// this.setState({ userInfo, error: null });
Alert.alert("success:" + JSON.stringify(userInfo));
} catch (error) {
if (error.code === statusCodes.SIGN_IN_CANCELLED) {
// sign in was cancelled
Alert.alert('cancelled');
} else if (error.code === statusCodes.IN_PROGRESS) {
// operation in progress already
Alert.alert('in progress');
} else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
Alert.alert('play services not available or outdated');
} else {
Alert.alert('Something went wrong', error.toString());
this.setState({
error,
});
}
}
}
这些是我的详细信息,所以请有人帮我,我找不到合适的解决方案online.and是的,我的SHA1和clientID是正确的,我已经检查过了。
我也遇到了这个问题,我搜索了很多答案,说检查你的客户Id和密钥哈希,我肯定这两个答案都是正确的。
让它为我工作的是我在https://console.cloud.google.com/apis/credentials在项目管理控制台(不是Firebase)中打开了OAuth身份,并添加了一个具有正确签名的Android Oauth客户端ID(出于某种原因,我之前没有其中一个)。重新下载GoogleServices json文件。
我还需要将webClientId设置为“client _ type”:3 Oauth客户端Id。然后它就起作用了。
不同模式的演练:
我正在尝试keytools-exportcert-keystore~/. android/debug.keystore-list-v
这当然是给我一个SHA1密钥,但它不起作用,搜索了一段时间后,我也仔细查看了我的项目/android/app
文件夹,发现有一个debug.keystore
密钥(其默认密码是android
,以防有些需要知道),所以我尝试了cd android
和keytools-exportcert-keystore app/debug.keystore-list-v
命令和我得到的密钥,工作得很好。我希望它会有所帮助。
我试图将谷歌登录集成到我的应用程序中。我没有后端服务器,我只是得到登录到我的应用程序的谷歌帐户的详细信息。 我第一次尝试使用谷歌登录的例子,但我得到了一个错误(除了打印下面的stacktrace外,没有进行任何代码更改)。我只是使用了signianctivity示例,因为我没有后端服务器。 密码 从我所读到的,这个问题可能是由SHA1一代引起的。 我遵循了完整的指南,但显然它不起作用。 我从gra
当我构建我的应用程序并尝试它时,没有任何错误,但当我在google play store上发布我的应用程序并尝试登录Facebook时,它会给我一个错误。这个错误是一个错误的散列键,因为散列键发生了变化(我得到了sign应用程序的散列键,通过许多方式给了我相同的has键,工作正常)这是第一个问题。 我的第二个问题是当尝试使用gmail登录(谷歌登录)获取字段错误。 (您有错误的OAuth2相关配置
我试图登录与谷歌在我的项目。登录页面工作正常,但当我试图获取数据,我得到这个错误。提前谢谢你。 我正在wampserver上运行我的php代码。我正在VisualStudio上编写页面。你可以看到我的代码。 //这是我的谷歌登录代码。php ( ! ) 致命错误:未捕获的GuzzleHttp\Exception\RequestException:cURL错误60:SSL证书问题:无法获取本地颁发者
我正在尝试使用我的应用程序中的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选项运行以获取堆栈跟踪。
公共规范。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的实现)