Client/Server

    • Store session data on the server and pass only a session ID between the server and the client. In such a case, you can choose where to store the payload on the server. For example, you can store session data in memory, in a specified folder, or Redis. If necessary, you can implement your own custom storage.

    Client-side sessions can’t be invalidated directly like server sessions. You can pass a session expiration time as a part of your session payload:

    Then, configure a session inside the block:

    Server

    Ktor provides different storage types for storing session data on the server. For example, you can use the in-memory storage for development purposes:

    You can learn more about the available storages from Storages.