Very recently I was working on implementing OaAuth flow a typical standard these days to authenticate against various social media sties like facebook, twitter etc. using my ADF app. Typically, the first step in OaAuth flow is to call to a url passing some sort of consumer or app id which then in turns after authentication invokes a callback url from your application to do the next step.
As a result, I needed a way to invoke the url from adf command button actionListener after constructing the url containing user supplied consumerKey. So, here is how you can invoke the url after that:
FacesContext fc = FacesContext.getCurrentInstance();
String callbackUrl = "https://www.facebook.com/dialog/oauth?client_id=" + fbClientId.getValue().toString() + "&redirect_uri=http://mycallbackURL&scope=publish_stream";
try
{
fc.getExternalContext().redirect(callbackUrl);
}
catch (IOException e)
{
e.printStackTrace();
}
So this is written in the actionListener and fbClientId is bound to a inputText on UI.
Friday, December 30, 2011
Subscribe to:
Post Comments (Atom)
3 comments:
Thanks for the post..It was nice being here..
I am totally delighted with incredibly blog greatly that saved me! God bless you “Progress is impossible without change, and those who cannot change their minds cannot change anything.” - George Bernard Shaw
Hi,
A very nice post .
It saved a lot of my time.
Thanks for it.
Post a Comment