Issue with NO_LTIK_OR_IDTOKEN_FOUND
See original GitHub issueGreetings! I am using a MERN stack and have been trying to connect ltijs to Coursera for a few days now. I have my mongodb running in port 5000 and the frontend is in port 3000. The first issue is lti.deploy()
has a conflict with port 3000, (I assume that is the default), I can change port, but i am not sure if that is the right thing to do? The other issue is that Coursera asks for a Public Tool Key and I was not sure where that comes in when using ltijs. Here is my code for reference:
const express = require("express");
const lti = require('ltijs').Provider;
const api = express.Router();
const uri = require('../../config/keys').mongoURI;
const password = require('../../config/keys').secretOrKey
//Configuration to register tool with coursera.
let consumerAuthorizationconfig = {
method: "JWK_SET",
key: "https://api.coursera.org/api/lti/keyset"
};
let consumerRedirectURL = <platform url> + "/project/submit";
let consumerAccessTokenURL = "https://api.coursera.org/api/lti/auth/accessToken/475~onehouraiorg";
let consumerAuthorizationURL = "https://api.coursera.org/api/lti/auth/token";
let consumerToolClientID = "cgAt5uT5Q6iALebk-XOoRg" ;
let consumerName = "coursera";
let consumerUrl = "https://coursera.org";
// Setup provider -
lti.setup("LTIKEY", // Key used to sign cookies and tokens
{ // Database configuration
url: uri,
connection: {} // optional
},
{ // 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: 'None' // Set sameSite to 'None' if the testing platform is in a different domain and https is being used
},
devMode: true // Set DevMode to false if running in a production environment with https
}
)
const setup = async () => {
// Configure main routes
lti.appRoute('/')
lti.loginRoute('/login')
// issue with port
await lti.deploy({port: 8000}); // issue with port 3000 in use
// Register platform
let platform = await lti.registerPlatform({
url: consumerUrl,
name: consumerName,
clientId: consumerToolClientID,
authenticationEndpoint: consumerAuthorizationURL,
accesstokenEndpoint: consumerAccessTokenURL,
authConfig: consumerAuthorizationconfig
})
// Set connection callback
lti.onConnect((connection, request, response) => {
// Call redirect function
console.log('on the connect option', response);
lti.redirect(response, '/');
})
}
setup();
Write now I am getting the following error and not sure how to proceed.
{“status”:401,“error”:“Unauthorized”,“details”:{“description”:“No Ltik or ID Token found.”,“message”:“NO_LTIK_OR_IDTOKEN_FOUND”,“bodyReceived”:{}}}
Coursera requests from my tool: Launch URL, Auth Request URL, Redirect URIs, and a Tool Public Key.
It has given me the following:
- PLATFORM OAUTH2 WELL-KNOWN/KEYSET URL
- PLATFORM OAUTH2 BEARER TOKEN RETRIEVAL URL
- PLATFORM OIDC AUTHENTICATION URL
- CLIENT ID
- DEPLOYMENT ID
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Great! I am happy it worked! I’ll close this issue for now, feel free to reopen it if you find any other issue.
This means that the platform is not registered correctly, the rest of the flow is working perfectly. The issue is in the registerPlatform method.
What URLs are you using for it? Specifically the
url
andclientId