How to I access an endpoint covered by next-auth through google app script

108 Views Asked by At

So recently I decided that I need to access a protected api endpoint in google app script. The only thing I can find is app-script-oauth2, the reason this does not work is because my middleware for the tRPC endpoint (code below) says if there is not a session (which is stored in a prisma db) you cannot access the api.

.middleware(async ({ ctx: { session }, next }) => {
  if (!session) {
    throw new TRPCError({ code: "UNAUTHORIZED" });
  }
  return next();
})

I have also tried to login and try to make the request but it seems as if the request is completely unrelated to the local session. I know this isn't a ton to work from but any help at all would be greatly appreciated.

0

There are 0 best solutions below