I'm trying to add a Login with linked in option to the app I'm currently working on using the OAuth2 object but not having much luck.
I've been trying to follow the api guide to OAuth2 authentication from here:
https://developer.linkedin.com/docs/oauth2but I'm just getting a blank screen.
My CN1 java looks like this:
Oauth2 auth2 = new Oauth2("https://www.linkedin.com/uas/oauth2/authorization",
"{Consumer Key}",
"",
"r_fullprofile%20r_emailaddress",
"https://www.linkedin.com/uas/oauth2/accessToken",
"{Consumer Secret}");
Oauth2.setBackToParent(true);
auth2.showAuthentication(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() instanceof String) {
String token = (String) evt.getSource();
String expires = Oauth2.getExpires();
} else {
Exception err = (Exception) evt.getSource();
err.printStackTrace();
Dialog.show("Error", "An error occurred while logging in: " + err, "OK", null);
}
}
});... none of the code in the actionPerformed method is being fired.
What I'm not sure about is the redirect_uri. In the Facebook connect code I see that this is just
www.codenameone.com so I assumed it wouldn't effect the outcome, but it seems to be completely bypassing the login and going directly to whatever this page is. Or if it's not the same as the one in the back-end I'm seeing an error.
Is this because I'm running it in the simulator?
or is it something specific to Linkedin?
What am I doing wrong here?
is there a more comprehensive guide on how the OAuth2 codenameone object works?
IDE: NetBeans
Simulator