Skip to content

Instantly share code, notes, and snippets.

@rphsoftware
Created January 6, 2025 11:15
Show Gist options
  • Save rphsoftware/bc7a98428fe538131a584e33cfc6e243 to your computer and use it in GitHub Desktop.
Save rphsoftware/bc7a98428fe538131a584e33cfc6e243 to your computer and use it in GitHub Desktop.
import express from "express";
const app = express();
const base = "https://example.com"; // replace this with a URL you control and host this on
app.get("/.well-known/openid-configuration", (req, res) => {
res.json({
issuer: "your mom",
authorization_endpoint: base + "/auth",
token_endpoint: base + "/token",
userinfo_endpoint: base + "/userinfo"
});
});
app.get("/auth", (req, res) => {
res.redirect(req.query.redirect_uri + "?code=1234&state=" + req.query.state);
});
app.post("/token", (req, res) => {
res.json({
access_token: "1234",
token_type: "Meow"
});
});
app.get("/userinfo", (req, res) => {
res.json({
sub: "..flag"
});
});
app.listen(8033);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment