OKTA React Login and Access Token

I am trying to do a simple login with email and password and get an access token. SignIn works fine and it returns success but after that trying to get the access token, it doesn’t return anything. Can any one help
import { OktaAuth, AccessToken, OktaAuthOptions, getToken} from ‘@okta/okta-auth-js’;

export const onJwtSignIn = ({email, password}, history) => {
return async (dispatch) => {
dispatch(fetchStart());
const body = {email, password};
try {
oktaAuth
.signIn({
username: email,
password: password,
})
.then((res) => {
const tokenManager = oktaAuth.tokenManager;
const accessToken = tokenManager.get(‘accessToken’);
const sessionToken = res.sessionToken;
localStorage.setItem(‘sessionToken’, sessionToken);
localStorage.setItem(‘accessToken’, accessToken);
})
.catch((err) => console.log(‘Found an error’, err));
} catch (err) {
if (err.response !== undefined) {
dispatch(
fetchError(
err.response.data !== undefined
? err.response.data.message
: ‘Unable to login. Please check email and password’,
),
);
} else {
dispatch(
fetchError(
‘There is a problem with the API. Please contact System Administrator.’,
),
);
}
}
};
};