Coder Social home page Coder Social logo

Multiple platforms about ltijs HOT 8 CLOSED

cvmcosta avatar cvmcosta commented on July 18, 2024
Multiple platforms

from ltijs.

Comments (8)

ahelord avatar ahelord commented on July 18, 2024 1

Hi, @Cvmcosta could you please provide me an example? I am a little confused

from ltijs.

Cvmcosta avatar Cvmcosta commented on July 18, 2024 1

In order to connect a tool provider to a platform with LTI they have to be registered in each other. And you can register as many platforms as you want just by calling the registerPlatform method multiple times:

// Register platforms
await lti.registerPlatform({ 
    url: 'https://platform.url1',
    name: 'Platform 1',
    clientId: 'TOOLCLIENTID1',
    authenticationEndpoint: 'https://platform.url/auth1',
    accesstokenEndpoint: 'https://platform.url/token1',
    authConfig: { method: 'JWK_SET', key: 'https://platform.url/keyset1' }
})
await lti.registerPlatform({ 
    url: 'https://platform.url2',
    name: 'Platform 2',
    clientId: 'TOOLCLIENTID2',
    authenticationEndpoint: 'https://platform.url/auth2',
    accesstokenEndpoint: 'https://platform.url/token2',
    authConfig: { method: 'JWK_SET', key: 'https://platform.url/keyset2' }
})

After doing so, your provider would be able to work with both platorms 1 and 2

from ltijs.

ahelord avatar ahelord commented on July 18, 2024 1

thanks i will try it

from ltijs.

Cvmcosta avatar Cvmcosta commented on July 18, 2024

Hello! Yes, you can register and work with as many platforms as you want.

from ltijs.

Cvmcosta avatar Cvmcosta commented on July 18, 2024

Great! Let me know how it goes :)

from ltijs.

ahelord avatar ahelord commented on July 18, 2024

What happens with the key that must be inserted in moodle would generate more than one?

from ltijs.

Cvmcosta avatar Cvmcosta commented on July 18, 2024

Ltijs generates one key per platform, you can just get the individual keys after registration:

// Register platforms
const platA = await lti.registerPlatform({ 
    url: 'https://platform.url1',
    name: 'Platform 1',
    clientId: 'TOOLCLIENTID1',
    authenticationEndpoint: 'https://platform.url/auth1',
    accesstokenEndpoint: 'https://platform.url/token1',
    authConfig: { method: 'JWK_SET', key: 'https://platform.url/keyset1' }
})
console.log(await platA.platformPublicKey())

const platB = await lti.registerPlatform({ 
    url: 'https://platform.url2',
    name: 'Platform 2',
    clientId: 'TOOLCLIENTID2',
    authenticationEndpoint: 'https://platform.url/auth2',
    accesstokenEndpoint: 'https://platform.url/token2',
    authConfig: { method: 'JWK_SET', key: 'https://platform.url/keyset2' }
})
console.log(await platB.platformPublicKey())

from ltijs.

ahelord avatar ahelord commented on July 18, 2024

@Cvmcosta thank you very much.

from ltijs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.