question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with NO_LTIK_OR_IDTOKEN_FOUND

See original GitHub issue

Greetings! 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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Cvmcostacommented, Mar 10, 2021

Great! I am happy it worked! I’ll close this issue for now, feel free to reopen it if you find any other issue.

1reaction
Cvmcostacommented, Mar 10, 2021

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 and clientId

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found