简体   繁体   English

Ionic/Cordova 如何生成哈希键?

[英]How does Ionic/Cordova generate hash key?

I'm working on adding Facebook API integration with ionic/Cordova and am trying to find the debug hash key that is generated for my app when I do:我正在努力添加 Facebook API 与 ionic/Cordova 的集成,并试图找到为我的应用程序生成的调试哈希键:

ionic build android

I know that it generates a new .keystore file at /userhomedir/.android/debug.keystore.我知道它会在 /userhomedir/.android/debug.keystore 生成一个新的 .keystore 文件。 But what does it set as the alias and password ?但是它设置的别名和密码是什么? And how can I retrieve this hash key after Cordova has created it for my app.在 Cordova 为我的应用程序创建它之后,我如何检索它。 I don't see the hash key being printed anywhere during the build process.我没有看到在构建过程中的任何地方打印哈希键。

I need the generated hash key to give to Facebook API to use their sign on SDK我需要生成的哈希键提供给 Facebook API 以使用他们在 SDK 上的登录

It seems Cordova use ~/android/debug.keystore with the password android似乎 Cordova 使用~/android/debug.keystore和密码android

To get it :为拿到它,为实现它 :

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

With password : android使用password : android

One answer that worked for me is this one :为我工作的一个答案是这样的一个

  • Copy the apkname.apk file you want to know the hash of to the ' Java\\jdk1.7.0_79\\bin ' folder将你想知道hash的apkname.apk文件复制到' Java\\jdk1.7.0_79\\bin '文件夹
  • Run this command keytool -list -printcert -jarfile apkname.apk运行这个命令keytool -list -printcert -jarfile apkname.apk
  • Copy the SHA1 value and convert it using this site复制SHA1值并使用此站点进行转换
  • Use the converted Keyhash value ( ex. zaHqo1xcaPv6CmvlWnJk3SaNRIQ= )使用转换后的 Keyhash 值(例如 zaHqo1xcaPv6CmvlWnJk3SaNRIQ=
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM