0
votes

I am storing a session cookie for future API calls after a user successfully logs in. When a user dismisses the account view without signing out, they should be able to go back to their account without going to the sign in view. They should only see return to the sign in view if they close the app, or sign out. I believe the session times out after 15 minutes. How can I check to make sure the session cookie is still valid?

Here is the cookie data.

<NSHTTPCookie
    version:1
    name:MYSESSIONID
    value:0000Rhq-31rVrlqPXpyK5kLVpsQ:-1
    expiresDate:'(null)'
    created:'2020-01-02 14:46:00 +0000'
    sessionOnly:TRUE
    domain:my.domain.com
    partition:none
    sameSite:none
    path:/
    isSecure:TRUE
    isHTTPOnly: YES
 path:"/" isSecure:TRUE isHTTPOnly: YES>
1
From client side, the only think one can know about a cookie validity is its left time to live. You use expiresDate null so I guess, there is no time out for this cookie. But really, cookies are managed by the server, it's your server who accepts or rejects a cookie. If the cookie is still stored and expireDate is not reached, cookie is valid, if cookie is dropped, or expired, it's over you have to sign in again.Poutrathor

1 Answers

0
votes

Because your expiresDate:'(null)' iOS will delete this automatically after you close session. If you are using WebView you can customize cookie expiresDate. If you are using AuthenticationSession you are not able to access cookies for security reason, in this case you need change cookies on server side.