Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. linked.addActionListener(new ActionListener() {
  2. @Override
  3. public void actionPerformed(ActionEvent evt) {
  4.  
  5. Oauth2 auth2 = new Oauth2("https://www.linkedin.com/oauth/v2/authorization?response_type=code",
  6. "81lq3qpacjvkcu",
  7. "https://www.codenameone.com","r_fullprofile%20r_emailaddress","https://www.linkedin.com/uas/oauth2/accessToken","vzwWfamZ3IUQsJQL");
  8. Oauth2.setBackToParent(true);
  9. auth2.showAuthentication(new ActionListener() {
  10.  
  11. public void actionPerformed(ActionEvent evt) {
  12. if (evt.getSource() instanceof String) {
  13. String token = (String) evt.getSource();
  14. String expires = Oauth2.getExpires();
  15.  
  16. System.out.println("Token=" +token + "Expires in " +expires );
  17.  
  18. } else {
  19. Exception err = (Exception) evt.getSource();
  20. err.printStackTrace();
  21. Dialog.show("Error", "An error occurred while logging in: " + err, "OK", null);
  22. }
  23. }
  24. });
  25.  
  26. }
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement