mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
7e03394734
commit
687907aa2b
5 changed files with 63 additions and 5 deletions
|
|
@ -401,12 +401,12 @@ Including an expiry time
|
|||
|
||||
``ds_actor`` cookies can optionally include a signed expiry timestamp, after which the cookies will no longer be valid. Authentication plugins may chose to use this mechanism to limit the lifetime of the cookie. For example, if a plugin implements single-sign-on against another source it may decide to set short-lived cookies so that if the user is removed from the SSO system their existing Datasette cookies will stop working shortly afterwards.
|
||||
|
||||
To include an expiry, add a ``"e"`` key to the cookie value containing a `base62-encoded integer <https://pypi.org/project/python-baseconv/>`__ representing the timestamp when the cookie should expire. For example, here's how to set a cookie that expires after 24 hours:
|
||||
To include an expiry, add a ``"e"`` key to the cookie value containing a base62-encoded integer representing the timestamp when the cookie should expire. For example, here's how to set a cookie that expires after 24 hours:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
import baseconv
|
||||
from datasette.utils import baseconv
|
||||
|
||||
expires_at = int(time.time()) + (24 * 60 * 60)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue