Skip to content
Playground(another site)

bynk.actor.oidc_identity_not_string_constructible

Error An Oidc actor's identity is not a string-constructible type.

An Oidc actor's identity is minted from the verified token's sub claim, which is a string, so the identity type must be a refined or opaque String. An actor with no identity is refused too. Declare a type over String, such as type UserId = String where NonEmpty, and name it. A Bearer actor has the same rule under bynk.actor.bearer_identity_not_string_constructible.

Example

type Age = Int where NonNegative
actor User { auth = Oidc(issuer = "https://issuer.example", audience = "my-api", jwks = "https://issuer.example/jwks"), identity = Age } // ✗ `sub` is a string, not an `Int`
type UserId = String where NonEmpty
actor User { auth = Oidc(issuer = "https://issuer.example", audience = "my-api", jwks = "https://issuer.example/jwks"), identity = UserId } // ✓ minted from `sub`

In the Book

See also

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