p scopes
  where scopes = words $ fromMaybe "" $ lookup "scope" $ unregClaims token

supportFormAuth ∷ Wai.Middleware
supportFormAuth app req respond = do
  let headers = Wai.requestHeaders req
  if "urlencoded" `isIn
ensureScope ∷ MonadThrow μ ⇒ JWT VerifiedJWT → ([Text] → Bool) → μ ()
ensureScope token p = guardBool errWrongAuthScope $ p scopes
  where scopes = words $ fromMaybe "" $ lookup "scope" $ unregClaims token
ensureScope token p = guardBool errWrongAuthScope $ p scopes
  where scopes = words $ fromMaybe "" $ lookup "scope" $ unregClaims token