Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{"status":401,"error":"Unauthorized","details":{"description":"No Ltik or ID Token found.","message":"NO_LTIK_OR_IDTOKEN_FOUND","bodyReceived":{}}} #169

Open
sunilkatkar-adeptus opened this issue Dec 9, 2022 · 2 comments

Comments

@sunilkatkar-adeptus
Copy link

sunilkatkar-adeptus commented Dec 9, 2022

@Cvmcosta I am new to LTIJS integration. Actually I am trying to create LTI 1.3 tool for coursera LMS using sample code provided by you.

But when I try to launch tool from coursera its showing me "{"status":401,"error":"Unauthorized","details":{"description":"No Ltik or ID Token found.","message":"NO_LTIK_OR_IDTOKEN_FOUND","bodyReceived":{}}}" this error.

Below is index.js that am using,

require('dotenv').config();
const path = require('path');
const routes = require('./src/routes');
const lti = require('ltijs').Provider;

let consumerAccessTokenURL = "https://api.coursera.org/api/lti/auth/accessToken/1220~sharedsuccessorg";
let consumerAuthorizationURL = "https://api.coursera.org/api/lti/auth/token";
let consumerToolClientID = "4G4uXxHdSqauLl8R3WqmXw" ;
let consumerName = "coursera";
let consumerUrl = "https://coursera.org";
let consumerAuthorizationconfig = {
method: "JWK_SET",
key: "https://api.coursera.org/api/lti/keyset"
};

const LTI-key = "li737drHRR+O2MLCmur0nHahZ0Z2kBP10HAKRUm39NIrKummL3Ja4xzDZIX1JltP";

lti.setup(LTI-key,
{
url: process.env.DB_HOST + '/' + process.env.DB_NAME,
connection: { user: process.env.DB_USER, pass: process.env.DB_PASS }
},
{ // Options
appRoute: '/', loginRoute: '/login', // Optionally, specify some of the reserved routes
cookies: {
secure: false, // Set secure to true if the testing platform is in a different domain and https is being used
sameSite: '' // Set sameSite to 'None' if the testing platform is in a different domain and https is being used
},
devMode: true
}
)

// Setting up routes
//lti.app.use(routes)

const setup = async () => {
lti.appUrl('/');
lti.loginUrl('/login');
await lti.deploy({port: 3000});
lti.whitelist(lti.appRoute(), { route: '/', method: 'get' })
let platform = await lti.registerPlatform({
url: consumerUrl,
name: consumerName,
clientId: consumerToolClientID,
authenticationEndpoint: consumerAuthorizationURL,
accesstokenEndpoint: consumerAccessTokenURL,
authConfig: consumerAuthorizationconfig
})
//console.log('the platform after the set is', platform);
const key = await platform.platformPublicKey()
// console.log('key',key)
// Set connection callback
lti.onConnect((connection, request, response) => {
// Call redirect function
lti.redirect(response, '/main')
})

// Set route accounting for issuer context
lti.app.get('/:iss/main', (req, res) => {
// Id token
console.log(res.locals.token)
res.send('It's alive!')
})
console.log("Outside onConnect");
}
setup();
module.exports = lti.app;

Please find attachment for launch, auth & redirect url setting.
Can you please help me out exactly where am going wrong.

image
image

@sunilkatkar-adeptus
Copy link
Author

@Cvmcosta After launch onConnect callback is not invoking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants