1
我想在代码名称1中使用Linkedin登录,但每当我单击登录按钮时,它都会显示空白弹出对话框。代码名称与Linkedin的一次登录
下面是我的代码
linked.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
Oauth2 auth2 = new Oauth2("https://www.linkedin.com/uas/oauth2/authorization",
"XXXXXXXXXX",
"https://www.codenameone.com","r_basicprofile",
"https://www.linkedin.com/uas/oauth2/accessToken",
"XXXXXXXXXX");
Oauth2.setBackToParent(true);
auth2.authenticate();
auth2.createAuthComponent(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
Log.p(evt.getSource().toString());
if (evt.getSource() instanceof String) {
String token = (String) evt.getSource();
String expires = Oauth2.getExpires();
System.out.println("Token=" +token + "Expires in " +expires);
}
else {
Exception err = (Exception) evt.getSource();
err.printStackTrace();
Dialog.show("Error", "An error occurred while logging in: " + err, "OK", null);
}
}
});
}
});
所以它甚至没有显示你的登录表单? (这是在模拟器?)检查模拟器中的网络监视器,看看有没有线索。 –
它不会在模拟器和物理设备中显示登录信息,请问您能否告诉我URL是否正确或代码中是否有任何错误? –
好点。您的网址不正确。您不应该在URL中包含任何查询字符串。只需使用“https:// www.linkedin.com/oauth/v2/authorization”即可。查询字符串将由'Oauth2'类自动添加。 –