Cvmcosta / ltijs

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

INVALID TOKEN in 5.0.2 #120

Open ahelord opened 3 years ago

ahelord commented 3 years ago

Hello when I install the plugin in moodle I get this error in Moodle

image

with this logs image

lti.setup(process.env.LTI_KEY,
    // Setting up database configurations
    {url: process.env.MONGO_URL},
    {
        appRoute: '/',
        loginRoute: '/login',
        logger: false,
        staticPath: APP_FOLDER,
        tokenMaxAge: false,
        cookies: {
            sameSite: 'None'
        }
    });

I have ltijs 5.0.2 I check the platform configuration and everything is fine, I don't know what could be failing

Cvmcosta commented 3 years ago

I see that you are receiving no cookies, my guess is that your browser does not like that cookies are sent as sameSite: None without also being secure: true.

If you can't use secure cookies i suggest turning on devMode: true on the options.

ahelord commented 3 years ago

Ready would be like this

lti.setup(process.env.LTI_KEY,
    // Setting up database configurations
    {url: process.env.MONGO_URL},
    {
        appRoute: '/',
        loginRoute: '/login',
        logger: false,
        staticPath: APP_FOLDER,
        tokenMaxAge: false,
       devMode:true
    });
Cvmcosta commented 3 years ago

Yes, that's it

ahelord commented 3 years ago

i get this TokenExpiredError: jwt expired

Cvmcosta commented 3 years ago

When exactly in the flow this error happens, i need to know what token is expiring. This should only happen if for some reason the idtoken is being reutilized

ahelord commented 3 years ago

Hello change to devMode:true and error change ISS_CLAIM_DOES_NOT_MATCH to jwt expired is when I open the tool in Moodle.

Cvmcosta commented 3 years ago

This might be an issue with the time either on Moodle or the LTI server, jwt expired is not controlled by LTIJS, this error is happening during the JWT verification.