@okta/okta-angular not authenticationg the user when redirected back

Hi ,
I have integrated with @okta/okta-angular library.My angular version is 9.
I have created a SPA in okta account.I am using the okta-hosted login process.
Locally I am able to login and the okta app is redirecting to my application.
In Production as well it is redirecting me to my application but when I am trying to authenticate the user it is always throwing false.and when I am trying to get the access token after redirecting even that is showing as undefined. I can see the values stored in cookies and session storage.I have added application domain in trusted origins.
we are hosting our application in Nginx.

Below is my code to authenticate the user :

const accessToken = await this.oktaAuth.getAccessToken();
const getconfig = await this.oktaAuth.getOktaConfig();
this.isAuthenticated = await this.oktaAuth.isAuthenticated();
if (!!accessToken) {
this.oktaAuth.getUser().then((claims:UserClaims) => {

Is there anything I have to add in Nginx or anywhere.

AM I missing anything to add in the code??
Can anybody help me on this?

@okta/okta-angular”: “^2.2.1”, this is the version I am using

Did you solve this?, have a similar problem.