diff --git a/routes/auth.js b/routes/auth.js
index 515e74d..d99beae 100644
--- a/routes/auth.js
+++ b/routes/auth.js
@@ -1,4 +1,4 @@
-import { app, db, globalConfig } from "../index.js" // Get globals from index
+// import { app, db, globalConfig } from "../index.js" // Get globals from index
import { checkTokenNew } from "../liberals/auth.js"
import { logRequest } from "../liberals/logging.js"
import { randomStringBase62, getHumanReadableUserAgent } from "../liberals/misc.js"
@@ -80,6 +80,7 @@ app.get("/api/auth/callback", (rreq,rres) => {
let newDestination = atob(rreq.query.state.split("_")[1].replace("-","/"))
rres.setHeader("Set-Cookie", `APIToken=${newToken}; Domain=${rreq.hostname}; Expires=${new Date(newExpiration).toUTCString()}; Path=/`).redirect(newDestination)
} else if (rreq.query.state === "display") {
+ // Change this to not write the token to a cookie
rres.setHeader("Set-Cookie", `APIToken=${newToken}; Domain=${rreq.hostname}; Expires=${new Date(newExpiration).toUTCString()}; Path=/`).send(`Success! Your token is ${newToken}`)
} else if (rreq.query.state === "close") {
rres.setHeader("Set-Cookie", `APIToken=${newToken}; Domain=${rreq.hostname}; Expires=${new Date(newExpiration).toUTCString()}; Path=/`).send(` Success! You may now close this window.`)
diff --git a/website/posts/20240409-API-Documentation.html b/website/posts/20240409-API-Documentation.html
index fd7f099..cee6fdf 100644
--- a/website/posts/20240409-API-Documentation.html
+++ b/website/posts/20240409-API-Documentation.html
@@ -106,5 +106,40 @@
Returns all request headers in JSON.
+ + +Returns JSON with the username of the token owner as well as what scopes the token has access to.
+ + +Redirects the user to ECLS to login. The state parameter can be used to specify how the login flow will behave. The accepted "states" are:
redirect - Redirects the user to a page after logging in. This paramter requires the destination paramter to also be set with the URL the user will be redirected to.display - Displays the generated token to the user after login. Currently, this still writes the new token to the APIToken cookie, though this is planned to change.close - This will close the page after logging in. This requires the page to be opened with JavaScript otherwise it will not automatically close.Invalidates the token used to access the endpoint.
+ + +Internal Use Only. This is the endpoint used by ECLS to finish the login flow. It will write the newly created token to the APIToken cookie as well as performing the action set by state, see login endpoint.