Get token already logged in session

I am using okta-signin-widget for authentication login is working fine. There is a scenario suppose if I login to the okta domain in a tab and then open my application in the next tab how can i get the access and id token for already logged in session.

Do you mean directly logging into Okta on one tab and then accessing your app on the other? If your app has the Okta sign-in widget, it will recognize the Okta session and give your app the token.

Check the answer here to see if it also answers your query: How do apps know about users logged in via okta UserHome?

@gsvivek Thanks for your reply.

Yes you are right i mean login to okta in one tab and then in next tab if i open my application.

I can get the session value by oktaSignIn.authClient.session.get() but we are using authorization_code flow to get the id_token and access_token by calling the token API and our backend is PHP. I can get the state and code state parameter do I need to do another ajax call to redirect_url with the code parameter in the request object?

I assume that this will be handled by the widget itself.