# Okta & Angular - persist session cookie after browser close?

**URL:** <https://devforum.okta.com/t/okta-angular-persist-session-cookie-after-browser-close/20091>\
**Category:** Questions\
**Created:** [April 5, 2022, 7:05am UTC](https://devforum.okta.com/t/okta-angular-persist-session-cookie-after-browser-close/20091 "2022-04-05T07:05:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lilweezy](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lilweezy](https://devforum.okta.com/u/lilweezy)\
**Post date:** [April 5, 2022, 7:05am UTC](https://devforum.okta.com/t/okta-angular-persist-session-cookie-after-browser-close/20091/1 "2022-04-05T07:05:03Z")

</div>

Hi! I’m using latest Okta libraries with Angular and the sign-in widget. I have an issue, where although the session is set to expire every 30 days the session cookie received by Okta in the browser is with lifetime Session, so on browser close I’m again asked to enter my credentials, because the token can’t be renewed due to the session cookie being deleted, although the session should be still active in Okta. How can I resolve this? Thanks!

---

<div class="post-metadata">

**Author:** ![lilweezy](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lilweezy](https://devforum.okta.com/u/lilweezy)\
**Post date:** [April 6, 2022, 9:19am UTC](https://devforum.okta.com/t/okta-angular-persist-session-cookie-after-browser-close/20091/2 "2022-04-06T09:19:52Z")

</div>

Update: Found that and tried it: [Share a sign-in session with native mobile apps | Okta Developer](https://developer.okta.com/docs/guides/shared-sso-android-ios/ios/main/#session-and-persistent-single-sign-on)

Managed to modify my session policy to use persistent cookie, however cookies’ expirations are still Session

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [April 6, 2022, 5:32pm UTC](https://devforum.okta.com/t/okta-angular-persist-session-cookie-after-browser-close/20091/3 "2022-04-06T17:32:08Z")

</div>

You made sure that you updated the policy that applies to the user you are testing with? And you haven’t tried to update the policy in the UI _after_ enabling `usePersistentCookie` (this can revert the change made via API)?

---

<div class="post-metadata">

**Author:** ![lilweezy](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lilweezy](https://devforum.okta.com/u/lilweezy)\
**Post date:** [April 6, 2022, 5:59pm UTC](https://devforum.okta.com/t/okta-angular-persist-session-cookie-after-browser-close/20091/4 "2022-04-06T17:59:42Z")

</div>

Thanks Andrea, yes. Looks like the issue comes from the fact, that I was testing only with users, which are administrators in Okta, which can’t have a persistent cookie… Very sad.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [February 12, 2024, 9:07pm UTC](https://devforum.okta.com/t/okta-angular-persist-session-cookie-after-browser-close/20091/5 "2024-02-12T21:07:23Z")

</div>

Closed on February 12, 2024, 9:07pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
