Commit 03c82e1e authored by Grant's avatar Grant
Browse files

add query params & homepage

parent 02af9c04
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -26,6 +26,24 @@ const renderStatic = (data: { title: string; json: any }) => {
};

app.get("/", async (req, res) => {
  res.contentType("html").send(`
    <html>
      <head>
        <title>Fediverse Auth Demo</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
      </head>
      <body>
        <h1>Fediverse Auth Demo</h1>
        <b>Query Parameters:</b>
        <code><pre>${JSON.stringify(req.query, null, 2)}</pre></code>

        <a href="/login">Test Out Fediverse Auth Login</a>
      </body>
    </html>
  `);
});

app.get("/login", async (req, res) => {
  const client = OpenIDController.get();

  res.redirect(client.getAuthorizationURL());