@dvelop-sdk
    Preparing search index...

    Function redirectToLoginPage

    • Redirect a request to the login page provided by the Identityprovider-App.

      import { redirectToLoginPage, UnauthorizedError } from "@dvelop-sdk/express-utils";

      app.use((err, req, res, next) => {
      if (err instanceof UnauthorizedError && req.accepts("text/html")) {
      redirectToLoginPage(req, res);
      } else {
      res.status(401).send("Unauthorized") // For Content-Types such as JSON return a 401 - Unauthorized
      }
      });

      Parameters

      • req: Request
      • res: Response

      Returns void