我正在尝试在登录时构建一个具有Linkedin集成的android应用程序,但是按下按钮后出现错误。它正在重定向到linkedin应用程序,但未显示任何授权屏幕,而是重定向到我的应用程序。
public class TestActivity extends AppCompatActivity {
private static final String TAG = "TestActivity";
private ArrayList<String> name = new ArrayList<>();
private TextView textView_name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
AppDataDBHelper appDBHelper = new AppDataDBHelper(this);
try {
Log.e(TAG, "Calling createDataBase");
appDBHelper.createDataBase();
} catch (IOException ioe) {
throw new Error("Unable to CREATE DATABASE");
} finally {
appDBHelper.close();
}
textView_name = findViewById(R.id.textView_name);
check();
String message = "";
for (int i=0; i<name.size(); i++) {
message = message + name.get(i) + "\n";
}
textView_name.setText(message);
}
private void check() {
try {
AppDataDBHelper appDataDBHelper = new AppDataDBHelper(this);
appDataDBHelper.openRead(); //without this app crashes
name = appDataDBHelper.readNames();
appDataDBHelper.close();
} catch (Exception e) {
throw new Error("error reading");
}
}
}
显示授权失败。 它显示的错误消息。
com.example.loginintegration E / Auth错误:{ “ errorCode”:“ UNKNOWN_ERROR”, “ errorMessage”:“传入的移动标识符无效\” com.example.loginintegration \“” }
protected $appends = [ 'status_fa' , 'type_fa' , 'delivery_type_fa' ];
是我的包裹名称。
有人可以帮我解决这个问题吗?
答案 0 :(得分:0)
您在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) {
}
}