auth-vir - v2.3.8
    Preparing search index...

    Function extractUserIdFromRequestHeaders

    • Extract the user id from a request by checking both the request cookie and CSRF token. This is used by host (backend) code to help verify a request. After extracting the user id using this, you should compare it to users stored in your database.

      Type Parameters

      • UserId extends string | number

      Parameters

      • headers: HeaderContainer
      • jwtParams: Readonly<ParseJwtParams>
      • cookieName: string = AuthCookieName.Auth
      • overrides: PartialWithUndefined<{ csrfHeaderName: string }> = {}

      Returns Promise<Readonly<UserIdResult<UserId>> | undefined>

      The extracted user id or undefined if no valid auth headers exist.