I am trying to secure my function and I have followed the docs here: Serverless Functions (API Endpoints) | RedwoodJS Docs
But isAuthenticated doesnt return Boolean value api side.
Here my code for reference:
import type { APIGatewayEvent, Context } from "aws-lambda";
import { authDecoder } from "@redwoodjs/auth-auth0-api";
import { useRequireAuth } from "@redwoodjs/graphql-server";
import { getCurrentUser, isAuthenticated } from "src/lib/auth";
import { logger } from "src/lib/logger";
const myHandler = async (event: APIGatewayEvent, _context: Context) => {
if (isAuthenticated) {
return {
statusCode: 200,
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
data: "Upload Key",
type: `${event.httpMethod}`,
sas: "saskey",
}),
};
}
return {
statusCode: 401,
}
};
export const handler = useRequireAuth({
handlerFn: myHandler,
getCurrentUser,
authDecoder,
})
Am I missing something?