KSessionCookieStorage
class KSessionCookieStorage(session: KSessionManager, apiHost: String? = null, accessTokenName: String = "access_token", refreshTokenName: String = "refresh_token") : CookiesStorage(source)
A CookiesStorage implementation backed by KSessionManager.
Maps the session tokens to named cookies so Ktor sends them automatically on every request. Cookie names are configurable to match your API's expectations.
This storage is restricted to specific hosts to prevent leaking session tokens to unrelated domains (e.g. analytics or 3rd party CDNs).
Parameters
session
The KSessionManager holding the tokens.
apiHost
The host (e.g. "api.example.com") to which these cookies should be sent. If null, cookies are sent to every host (not recommended).
accessTokenName
Cookie name for the access token.
refreshTokenName
Cookie name for the refresh token.
Constructors
Link copied to clipboard
constructor(session: KSessionManager, apiHost: String? = null, accessTokenName: String = "access_token", refreshTokenName: String = "refresh_token")