Not able to get accessToken after login redirect, but able to get it if refresh the page

Hi, I’m working with React Server Side Single page app, and I upgraded the okta-react and okta-auth-js versions from 3 to 6.

let token = await this.props.oktaAuth.tokenManager.get('accessToken');

I get the token “undefined” when users log or sign in and land on the dashboard page. but when I refresh the page, I get the token.

oktaAuth.signInWithRedirect({ sessionToken });

this method is used after successful login and signup.