Setu-TS
    Preparing search index...

    Function authorizationFailureInit

    • Returns the status, title and detail of a standard authorization refusal — the ONE owner of those values.

      respondWithAuthorizationFailure writes it, and an error thrown from a handler brands itself with it (through withHttpStatusHint), so a guard's refusal and a thrown refusal answer the same body under the application's configured error format.

      The insufficient-privileges detail is deliberately fixed text: naming the role, permission or policy a caller lacks tells an unauthorized caller what to acquire. The second-factor-required detail says only what the caller must do, not which factor or which policy produced the refusal.

      Parameters

      Returns HttpStatusHint

      The frozen response init for that refusal

      throw withHttpStatusHint(new Error('denied'), authorizationFailureInit('insufficient-privileges'));
      

      0.9.0