04/24/2022, 4:12 PM
Hey guys, I had a question two days back and wanted to share the solution here: I needed a way to generate a separate jwt token for a third party service given a specific signing key. Problem statement: I wanted to patch it in via the
override, but the session was not available in the response. Solution was given by @rp to use a funtion override instead:
Copy code
override: {
          functions: originalImplementation => ({
            refreshSession: async (input) => {
              const session = await originalImplementation.refreshSession(input)
              await addJWTTokenToTokenPayload(session)
              return session
            createNewSession: async (input) => {
              const session = await originalImplementation.createNewSession(input)
              await addJWTTokenToTokenPayload(session)
              return session