当前位置:首页 > 操作系统 > Ios

javascript-使用cordova的Google登录无法正常工作. Android中的错误10和IOS中的错误请求

我有一个使用cordova构建的Android / IOS应用.

由于我现在正在使用ssl运行服务器,因此无法使用inappBrowser打开来自Google的请求.因此,我必须使用带有this插件的本机登录名. (这是我找到的最可靠的)

在阅读了许多帖子(thisthis..)之后,我认为问题出在我(试图)生成我的密钥文件的方式上

keytool -exportcert -keystore ~/.android/debug.keystore -list -v -alias myAppName

(使用空密码)提示

error de herramienta de claves: java.lang.Exception: El alias <myAppName> no existe (doesn't exist)
java.lang.Exception: El alias <myAppName> no existe
    at sun.security.tools.keytool.Main.doPrintEntry(Main.java:1738)
    at sun.security.tools.keytool.Main.doCommands(Main.java:1064)
    at sun.security.tools.keytool.Main.run(Main.java:343)
    at sun.security.tools.keytool.Main.main(Main.java:336)

这是否意味着它不起作用?

关于错误:

window.plugins.googleplus.login(
    {
      'scopes': 'profile email', 
      'webClientId': 'xxxxxxxxx.apps.googleusercontent.com', 
      'offline': true, 
    },
    function (obj) {
      alert(JSON.stringify(obj)); /
    },
    function (msg) {
      alert('error: ' + msg); // <--- It alerts 'error: 10'
    }
);

任何提示将非常欢迎

-编辑(现在已解决)-

刚在IOS(模拟器)中测试过,结果甚至更糟:

编辑2

我尝试两种方式安装(相同结果)

> cordova插件添加cordova-plugin-googleplus –save –variable REVERSED_CLIENT_ID = myreversedclientid
> cordova插件添加https://github.com/EddyVerbruggen/cordova-plugin-googleplus –save –variable REVERSED_CLIENT_ID = myreversedclientid

(以及多次,在“设置” .key之前和之后)

-编辑3-

顺便说一句,这个错误是什么意思? (也找不到)

解决方法:

I don’t seem to find a GoogleService-Info.plist file. In which folder should it be?

自从我们谈论iOS以来,我相信GoogleService-Info.plist文件丢失了,这是一个问题.请看这个EddyVerbruggen/cordova-plugin-googleplus

To get your iOS REVERSED_CLIENT_ID, generate a configuration file here. This GoogleService-Info.plist file contains the REVERSED_CLIENT_ID you’ll need during installation. This value is only needed for iOS.

The REVERSED_CLIENT_ID is also known as the “iOS URL Scheme” on the Developer’s Console.

Login on iOS takes the user to a SafariViewController through the Google SDK, instead of the separate Safari browser.

要生成配置文件,请转到:https://developers.google.com/mobile/add?platform=ios

在您的iOS项目的根目录中找到此文件

就我而言,GoogleService-Info.plist文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CLIENT_ID</key>
    <string>18643434937-j6ofvkktk1uklqjv61ecr75f1llqki0f.apps.googleusercontent.com</string>
    <key>REVERSED_CLIENT_ID</key>
    <string>com.googleusercontent.apps.18643434937-j6ofvkktk1uklqjv61ecr75f1llqki0f</string>
    <key>PLIST_VERSION</key>
    <string>1</string>
    <key>BUNDLE_ID</key>
    <string>com.app.client</string>
    <key>PROJECT_ID</key>
    <string>app-c6c82</string>
    <key>IS_ADS_ENABLED</key>
    <false/>
    <key>IS_ANALYTICS_ENABLED</key>
    <false/>
    <key>IS_APPINVITE_ENABLED</key>
    <false/>
    <key>IS_GCM_ENABLED</key>
    <false/>
    <key>IS_SIGNIN_ENABLED</key>
    <true/>
    <key>GOOGLE_APP_ID</key>
    <string>1:68743434937:ios:b03bcd3b3f571a56</string>
</dict>
</plist>

对于Android google-services.json:

前往:https://developers.google.com/mobile/add?platform=android

并在那里生成它.

它应该看起来像:

{
  "project_info": {
    "project_number": "68643434935",
    "project_id": "myapp-c6c82"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:68643434935:android:71bc3a4035ab9002",
        "android_client_info": {
          "package_name": "com.agan.armoa"
        }
      },
      "oauth_client": [
        {
          "client_id": "68643434935-mqm5s8lubfr5j5s3bj62eigbod0h083s.apps.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.agan.armoa",
            "certificate_hash": "759A66458E30A70628F2E6A66C46240E21676B72"
          }
        },
        {
          "client_id": "68643434935-bc48465luu0r77tufpf4fumv0bd5pta2.apps.googleusercontent.com",
          "client_type": 3
        },
        {
          "client_id": "68643434935-gpdj67581deilm3refkgobuvneceisqt.apps.googleusercontent.com",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "AIzaSyDB6g1-nMbZ9aZkic2dCz8QrcqHfCSDrsw"
        }
      ],
      "services": {
        "analytics_service": {
          "status": 1
        },
        "appinvite_service": {
          "status": 1,
          "other_platform_oauth_client": []
        },
        "ads_service": {
          "status": 1
        }
      }
    },
    {
      "client_info": {
        "mobilesdk_app_id": "1:68643434935:android:b03bcd3b3f571a56",
        "android_client_info": {
          "package_name": "com.myapp.client"
        }
      },
      "oauth_client": [
        {
          "client_id": "68643434935-25ciu2gccfv70m08sc7c4fr3v0gqe89m.apps.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.myapp.client",
            "certificate_hash": "E90A75A9AA4470337AE5ECD87C3416DDB1109BE1"
          }
        },
        {
          "client_id": "68643434935-bc48465luu0r77tufpf4fumv0bd5pta2.apps.googleusercontent.com",
          "client_type": 3
        },
        {
          "client_id": "68643434935-gpdj67581deilm3refkgobuvneceisqt.apps.googleusercontent.com",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "AIzaSyDB6g1-nMbZ9aZkic2dCz8QrcqHfCSDrsw"
        }
      ],
      "services": {
        "analytics_service": {
          "status": 1
        },
        "appinvite_service": {
          "status": 1,
          "other_platform_oauth_client": []
        },
        "ads_service": {
          "status": 1
        }
      }
    }
  ],
  "configuration_version": "1"
}

[编辑2]

关于您的错误:

keytool -exportcert -list -v -alias project -keystore ~/.android/debug.keystore I get this error: error de herramienta de claves: java.lang.Exception: El archivo de almacén de claves no existe: /Users/toni/.android/debug.keystore java.lang.Exception: El archivo de almacén de claves no existe: /Users/toni/.android/debug.keystore

尝试运行:

keytool -genkey -v -keystore ~/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"

生成?/ .android / debug.keystore

另外看看:https://developer.android.com/studio/publish/index.html#debugmode

[编辑3]

错误10表示:

public static final int DEVELOPER_ERROR

The application is misconfigured. This error is not recoverable and
will be treated as fatal. The developer should look at the logs after
this to determine more actionable information.

Constant Value: 10

请参阅DOCS和类似的错误解决方案:Error: Status{statusCode=DEVELOPER_ERROR, resolution=null}


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!