Check Validity of Session Cookie

699 Views Asked by At

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

There are 1 best solutions below

0
canister_exister On

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.