Skip to content
Playground(another site)

bynk.actor.signed_cookie_read_directly

Error A typed cookies field reads the session cookie that a route's SignedCookie actor consumes.

A SignedCookie actor reads its session cookie at the boundary, verifies it and hands the handler only the identity, so the signed value never reaches handler code. A cookies record on the same route that names that cookie (by its own name or @name) would ask for the raw value, so it is refused, and the router leaves the cookie out of a raw RequestCookies view too. Read the identity from the by binder, and keep other cookies (a theme, a language) in the record.

Example

type Prefs = {
@name("__Host-session") session: Option[String], // ✗ the session cookie
theme: Option[String],
}
type Prefs = {
theme: Option[String], // ✓ other cookies only
}

In the Book

See also

  • Every code in its category, Actors, on the diagnostic index.
  • bynk explain bynk.actor.signed_cookie_read_directly shows the same from the installed toolchain, without a network.