itsme

1.2.5 • Public • Published

node-itsme

Unofficial NodeJs itsme library used to authenticate users.

Simple example:

const ItsMe    = require('itsme');

async function main() {

    const itsme = new ItsMe({
        client_id: 'test account',
        auth_redirect: 'https://localhost:8080/itsme'
    });

    itsme.setKeys([
      enc_key,
      sig_key
    );

    //-----

    const authUrl = await itsme.authUrl('openid profile address phone service:PROJECT_LOGIN');

    console.log('Please sign in on the following url:')
    console.log(authUrl);
    console.log("");
    
    //-----
    //Once token received:

    const token = "...";
    const authResult = await itsme.parseAuthResponse(token)

    console.log("");
    console.log("Parsed auth response:")
    console.log(JSON.stringify(authResult, null, 4));
    console.log("")

    const userinfo = await itsme.userinfo( authResult.access_token );
    console.log("Received userinfo:")
    console.log(JSON.stringify(userinfo, null, 4));
}

main().catch(console.error)

Package Sidebar

Install

npm i itsme

Weekly Downloads

2

Version

1.2.5

License

MIT

Unpacked Size

19.6 kB

Total Files

7

Last publish

Collaborators

  • skyhark