I want to access the linkedin data if user authenticates the application. I have already gone through several examples but still i am unable to understand what should i write inside the controller for this task.
what i want is my controller should connect to linkedin login page and then user will enter the details. after that application will take the data and the page will redirect to another welcome page.
Here is my LoginController.
@Controller
public class LoginController {
@RequestMapping(value="/login", method = RequestMethod.GET)
public ModelAndView welcome() {
ModelAndView mav = new ModelAndView();
mav.setViewName("loginPage");
return mav;
}
}
but for below controller, how should i approach?
@Controller
public class LinkedInController {
private LinkedIn linkedin;
private ConnectionRepository connectionRepository;
}
Thanks in advance!!!
I hate to throw you back into the world of tutorials, but I found the Quick Start to be useful. Part of your confusion sounds like it's related to how you're visualizing the flow:
That's not quite how they describe the responsibility of your Controller. You are expected to simply take the API binding and do whatever work you need to do. At that point you have already had them log in on LinkedIn.
From: Spring Social Quick Start - Step 4 Invoke APIs
It's Spring Social's job to handle the connection to LinkedIn, which they do with the ProviderSignInController (see Steps 2 - Configure Spring Social and 3 - Create Views of the Quick Start).
The
ProviderSignInController
they create maps itself to/signin/{providerId}
requests which the view then allows users to access.I'll stress again: check out the Quick Start. It models almost exactly what you describe you want: a Social login which, when complete, redirects to a welcome page displaying the user's Facebook friends.