Add additional debug logging to InternalOAuthError case

This commit is contained in:
Tom Moor
2023-05-01 20:40:23 -04:00
parent 7d7781d795
commit 2ceba5039b

View File

@@ -1,5 +1,6 @@
import passport from "@outlinewiki/koa-passport";
import { Context } from "koa";
import { InternalOAuthError } from "passport-oauth2";
import env from "@server/env";
import { AuthenticationError } from "@server/errors";
import Logger from "@server/logging/Logger";
@@ -16,7 +17,10 @@ export default function createMiddleware(providerName: string) {
},
async (err, user, result: AuthenticationResult) => {
if (err) {
Logger.error("Error during authentication", err);
Logger.error(
"Error during authentication",
err instanceof InternalOAuthError ? err.oauthError : err
);
if (err.id) {
const notice = err.id.replace(/_/g, "-");