
PavanB.10823 (Customer) asked a question.
Hi,
i am trying to integrate OKTA into my react application and stumbled at renewal token part. i have looked for documentation but couldn't find any working example. after going through couple questions posted by other people i ended up with following config.
const config = {
issuer: process.env.REACT_APP_OKTA_ORG_URL,
redirect_uri: `${window.location.origin}/implicit/callback`,
client_id: process.env.REACT_APP_OKTA_CLIENT_ID,
scope: ['openid', 'profile', 'email', 'groups'],
pkce: true,
cookies: {
secure: window.location.protocol === 'https:',
},
tokenManager: {
autoRenew: true,
secure: true,
storage: 'localStorage',
}
};
<Router>
<Security {...config}>
<App />
</Security>
</Router >
is this setting enough to auto renew tokens silently without asking user to re login every time ?
or is there any method or hooks available to capture the session expiration event something like below .
<below is just an example was assuming something like below is already available >
const onSessionExpired = ()=>{
authState.renew();
}

Hi PavanKumar,
This might be what you're looking for: https://developer.okta.com/docs/guides/refresh-tokens/overview/
If not, feel free to post this question on our Okta Developer Forums: https://devforum.okta.com, and they should be able to help you with this.
Thanks!
Tim
Okta, Inc.