How to get session when okta authenticates the application

I did follow the below and got my application working.
https://developer.okta.com/docs/guides/implement-grant-type/authcode/main/#grant-type-flow

But I couldnt get the session once the user is authenticated.
I am using ServletFilter to navigate to okta login page(via /authorize endpoint), but i am not getting session in doFilter method.

I am using Primefaces for my UI.

Here is my sample code. In ServletFilter class… it comes here, but return session always empty.

@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
HttpSession httpSession = httpServletRequest.getSession(false); // return null here

This is the code in doFilter where I navigate to okta login page.

https://XXX.oktapreview.com/oauth2/default/v1/authorize?client_id=yyyyyy&response_type=code&response_mode=query&scope=openid%20email%20profile%20groups&state=xyz&redirect_uri=http://<host>:8192/app

I created my own http session in the application and killed it when i logout. Got killed okta session by calling /logout endpoint.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.