Cvmcosta / ltijs

Turn your application into a fully integratable LTI 1.3 tool provider.
https://cvmcosta.github.io/ltijs/
Apache License 2.0
296 stars 65 forks source link

Error with missing_validation_cookie #187

Closed ErnestoCamilo closed 1 year ago

ErnestoCamilo commented 1 year ago

` async function startServer() { try { // Load environment variables dotenv.config();

// Create Express app
const app = express();

// Setup LTI Provider
Provider.setup(
  "LTI_KEY",
  {
    plugin: new Firestore({ collectionPrefix: "Ltijs-" }),
  },
  {
    staticPath: path.join(__dirname, "./public"), // Path to static files
    appUrl: "/api/lti",
    cookies: {
      secure: true, // Set secure to true if the testing platform is in a different domain and https is being used
      sameSite: "None", // Set sameSite to 'None' if the testing platform is in a different domain and https is being used
    },
    serverAddon: express,
  }
);

// When receiving successful LTI launch redirects to app
Provider.onConnect((token: any, req: Request, res: Response) => {
  Logger().info(`User connected: ${JSON.stringify(token)}`);
  return res.send("User connected!");
});

// When receiving deep linking request redirects to deep screen
Provider.onDeepLinking((token: any, req: Request, res: Response) => {
  Logger().info(`Deep Linking is working: ${JSON.stringify(token)}`);
  return res.send("Deep Linking is working!");
});

// Setting up routes
Provider.app.use(routes);

// Add ltijs routes to the app
app.use("/api/lti", Provider.app);

const platform = Provider.registerPlatform({
  url: "https://lti-ri.imsglobal.org",
  name: "LTI itopia Platform server conf",
  clientId: "579538783315-l9a6mqp3bjn13dbsa8aj4q68qbj13ggu.apps.googleusercontent.com",
  authenticationEndpoint: "https://lti-ri.imsglobal.org/platforms/4198/authorizations/new",
  accesstokenEndpoint: "https://lti-ri.imsglobal.org/platforms/4198/access_tokens",
  authConfig: {
    method: "JWK_SET",
    key: "https://lti-ri.imsglobal.org/platforms/4198/platform_keys/3853.json",
  },
});

Logger().info(`Platform registered: ${JSON.stringify(platform)}`);

// Api status
app.get("/api/status", (req, res) => {
  res.send("Hello World");
});

// Start server
const port = process.env.PORT ? Number(process.env.PORT) : 3000;
app.listen(port, () => {
  Logger().info(`Server listening on port ${port}`);
});

} catch (error) { Logger().error(Failed to start server: ${error}); } } startServer(); ` I have this configuration in my index.ts file when I tried to launch from the platform (https://lti-ri.imsglobal.org/) to my app route I having this error. freesnippingtool com_capture_20230508153343