Skip to content

Commit

Permalink
Add console log statements for debugging and error
Browse files Browse the repository at this point in the history
handling
  • Loading branch information
walnuts1018 committed Nov 6, 2023
1 parent 64240ed commit f7a8f6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion front/src/app/api/auth/[...nextauth]/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const authOptions: NextAuthOptions = {
isNewUser?: boolean;
session?: any;
}) => {
//console.log("JWT Callback token", token);
if (user) {
token.role = user.role;
}
Expand All @@ -40,6 +41,7 @@ export const authOptions: NextAuthOptions = {
token.idToken = id_token;
token.refreshToken = refresh_token;
token.expiresAt = expires_at;
console.log("Refreshed token");
} catch (e) {
console.error(e);
return { ...token, error: "RefreshAccessTokenError" as const }
Expand Down Expand Up @@ -76,8 +78,9 @@ const refreshIDToken = async (refreshToken: string) => {
}),
});
const data = await response.json();
//console.log("Data:", data);
if (!response.ok) {
throw new Error(data.error_description || "Unknown error");
throw new Error(data.error_description || data.error || "Unknown error");
}

return {
Expand Down

0 comments on commit f7a8f6f

Please sign in to comment.