android 中的 Linkedin 集成错误:在linkedin 应用程序中未显示授权屏幕

Rag*_*dra 5 android login linkedin-api

我正在尝试在登录时构建一个带有linkedin 集成的Android 应用程序,但在按下按钮后出现错误。它正在重定向到linkedin 应用程序,但没有显示任何授权屏幕并重定向到我的应用程序。

Code:
     LISessionManager.getInstance(getApplicationContext()).init(this, buildScope(), new AuthListener() {
        @Override
        public void onAuthSuccess() {
            // Authentication was successful.  You can now do
            // other calls with the SDK.
            Toast.makeText(MainActivity.this,"Authrization Success",Toast.LENGTH_SHORT).show();
            fetchDetailsLinkedin();
        }

        @Override
        public void onAuthError(LIAuthError error) {
            Log.e("Auth Error",error.toString());
            // Handle authentication errors
            Toast.makeText(MainActivity.this,"Authrization Failed",Toast.LENGTH_SHORT).show();
        }
    }, true);
Run Code Online (Sandbox Code Playgroud)

同时显示授权失败。它显示的错误消息。

com.example.loginintegration E/Auth Error: { "errorCode": "UNKNOWN_ERROR", "errorMessage": "传入的移动标识符无效\"com.example.loginintegration\"" }

com.example.loginintegration是我的包名。

谁能帮我解决这个问题?

小智 -3

linkedIn 开发者控制台上的哈希密钥不正确。使用以下函数生成哈希密钥并粘贴到开发人员控制台上。它会像魅力一样发挥作用。干杯!!!

fun generateHashKey() {
        try {
            val info = packageManager.getPackageInfo(
                    application.packageName,
                    PackageManager.GET_SIGNATURES)
            for (signature in info.signatures) {
                val md = MessageDigest.getInstance("SHA")
                md.update(signature.toByteArray())
                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT))
            }
        } catch (e: PackageManager.NameNotFoundException) {

        } catch (e: NoSuchAlgorithmException) {

        }

    }
Run Code Online (Sandbox Code Playgroud)