Skip to content

SSOClient

Green_Lab edited this page Mar 10, 2022 · 2 revisions

class SSOClient:

Constructor

new SSOClient(options)

options:

{
    iserv: 'mein-iserv.de', // It is important to type the url like this without a slash at the end and no https:// in the beginning
    clientId: 'YOUR CLIENT ID HERE',
    clientSecret: 'YOUR CLIENT SECRET/GEHEIMNIS HERE',
    redirectUri: 'http://localhost/openid-granted',
}

Returns a new SSOClient

Init

await SSOClient.init()

Initializes the SSOClient. Need to be awaited.

getRedirector

SSOClient.getRedirector()

Returns a new codeVerifier which needs to be stored in a session or something familar and a redirectURI combined in an object:

{
  codeverifier: 'CODEVERIFIER',
  redirectUri: 'http://localhost/openid-granted'
}

fetch

await SSOClient.fetch(req, codeVerifier)

Returns a new User. Needs to be awaited. Expects the request from the WebServer or express and the codeVerifier which was returned by getRedirector

Clone this wiki locally