Closed GoogleCodeExporter closed 8 years ago
Can you please show the code where you are calling connect method.
Please make sure you are calling connect method in socialAuthSuccessAction.do
action class.
Regards
Tarun
Original comment by tar...@brickred.com
on 11 Apr 2012 at 10:41
hi tarun,
i did not get the socialAuthSuccessAction.do action class .
actually i am doing it in one file. please see my code below
public void connectFacebook() throws Exception {
String id = "facebook";
SocialAuthConfig config = SocialAuthConfig.getDefault();
String propUrl = "oauth_consumer.properties";
config.load(propUrl);
SocialAuthManager manager = new SocialAuthManager();
manager.setSocialAuthConfig(config);
// String
// successUrl="http://opensource.brickred.com/socialauthdemo/socialAuthSuccessAction.do";
String successUrl = "http://example.com:8080/ProgrammingChamps/faces/Authenticated.jsp";
String url = manager.getAuthenticationUrl(id, successUrl);
HttpServletRequest request = (HttpServletRequest) FacesContext
.getCurrentInstance().getExternalContext().getRequest();
request.getSession(true).setAttribute("authManager", manager);
FacesContext.getCurrentInstance().responseComplete();
FacesContext.getCurrentInstance().getExternalContext().redirect(url);
ExternalContext ectx = FacesContext.getCurrentInstance()
.getExternalContext();
HttpServletRequest requestAfterRedirection = (HttpServletRequest) ectx.getRequest();
HttpSession session = requestAfterRedirection.getSession(true);
manager = (SocialAuthManager) session.getAttribute("authManager");
AuthProvider provider =manager.connect
(SocialAuthUtil.getRequestParametersMap(requestAfterRedirection));
Profile p = provider.getUserProfile();
String userName = p.getFirstName();
System.out.println(userName);
}
i am getting error due to 4th last line(i think).
regards
Anil Sharma
Original comment by anil.kum...@gmail.com
on 11 Apr 2012 at 12:46
Hi Anil
While registering the application in facebook to get application key/secret, we
have to provide the return url which is "socialAuthSuccessAction.do" in our
case.
As you are using our application key/secret, you will have to use same domain
and return url to make it work.
Regards
Tarun
Original comment by tar...@brickred.com
on 17 Apr 2012 at 8:38
hi tarun,
thanx for contacting. actually i am done with that issue .
your website does not have any jsf implementation of brickred socialAuth.
i have given that on my blog.
so if any body else faces any problem in jsf or needs example of brickred
implementation you can share this link with him
http://31stdimension.blogspot.in/2012/04/how-to-connect-facebook-using-jsfjava.h
tml
regards
Anil sharma
Original comment by anil.kum...@gmail.com
on 17 Apr 2012 at 4:08
Hi Anil
Thanks for providing this.
Regards
Tarun
Original comment by tar...@brickred.com
on 27 Apr 2012 at 8:39
Original issue reported on code.google.com by
anil.kum...@gmail.com
on 10 Apr 2012 at 12:27Attachments: