Android Google和facebook三方登陆遇到的坑

2021-07-07  本文已影响0人  扎心的_老铁

1.facebook

Facebook登录官方指导文档:https://developers.facebook.com/docs/facebook-login/android/

facebook三方登录要想正常使用,需要满足以下几点:

try {
            val info = packageManager.getPackageInfo(
                BuildConfig.APPLICATION_ID,  //Insert your own package name.
                PackageManager.GET_SIGNATURES
            )
            for (signature in info.signatures) {
                val md: MessageDigest = MessageDigest.getInstance("SHA")
                md.update(signature.toByteArray())
                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT))
            }
        } catch (e: PackageManager.NameNotFoundException) {
        } catch (e: NoSuchAlgorithmException) {
        }

2.Google

Google登录官方指导文档:https://developers.google.com/identity/sign-in/android/sign-in
参考这篇博客文章:https://blog.csdn.net/u010976213/article/details/112893637
google登录还好,照着官方文档走就行

3.上架GooglePlay后登录报错

上架后由于签名被google改掉了,参考这里:https://blog.csdn.net/m0_37698386/article/details/106289041
具体还是记一下吧,省的人家的链接一旦失效就麻烦了
openssl下载地址:
https://code.google.com/archive/p/openssl-for-windows/downloads

google

https://console.developers.google.com/apis/credentials

image.png

facebook

image.png
上一篇下一篇

猜你喜欢

热点阅读