But of course without a session id this successAuth.xhtml is not connected to the user session.
If your servletcontainer supports URL rewriting (by default, they all do), then you can just pass the session ID as URL path fragment.
HttpSession session = (HttpSession) externalContext.getSession();
String callbackURL = "http://www.myJsfApp.com/successAuth.xhtml;jsessionid=" + session.getId();
// ...
See also:
The page is just the "raw" xhtml file (with all its tags) and no html.
That will happen when the FacesServlet
isn't been invoked. The request URL must match the URL pattern of the FacesServlet
in order to invoke it. So, if you have configured it to listen on for example /faces/*
URLs, then you should obviously change the URL to faces/successAuth.xhtml
.
HttpSession session = (HttpSession) externalContext.getSession();
String callbackURL = "http://www.myJsfApp.com/faces/successAuth.xhtml;jsessionid=" + session.getId();
// ...
Alternatively, you can also just map the FacesServlet
on *.xhtml
, this way you never need to fiddle with virtual URLs.
See also: