VulcanJwtRegister
Creates a manager for authentication with VULCAN HebeCE API.\
Params:
keypair - The Keypair to authenticate.
apiap - The https://eduvulcan.pl/api/ap content
autoRefreshAp - OPTIONAL: Should new JWT tokens be fetched automatically?
Returns: JwtOutput
Example code:
const { VulcanJwtRegister, Keypair } = require('hebece');
const apiap = '<html><body><input id='ap' type='hidden' value='{"Success":true,"Tokens":["Some.Jwt.Here", "Another.Jwt.here"],"Alias":"example@example.com","Email":"example@example.com","EmailCandidate":null,"GivenName":"Jacek","Surname":"Różycki","IsConsentAccepted":true,"CanAcceptConsent":true,"AccessToken":"1yearapiaptoken","ErrorMessage":null,"Capabilities":["EMAIL_CONFIRMATION"]}' /></body></html>'
(async () => {
const keypair = await (new Keypair()).init();
// NOTE: /api/ap can be static, the parser takes care of getting new JWT's if they expire.
const jwt = await (new VulcanJwtRegister(keypair, apiap, false /* true by default */)).init();
console.log(jwt) // JwtOutput
})()Last updated