1.0.24 • Published 9 months ago
lightweight-openid v1.0.24
Important Note!
This package works from version 1.0.24 and above. If you are using older version, please update.
simple-openid
This package is designed to utilise OpenId 2.0 in a lightweight and easy way.
To run it, example for Steam API:
import { OpenIdClient } from 'lightweight-openid';
const client = new OpenIdClient();
const STEAM_OPENID_URL = 'https://steamcommunity.com/openid';
const OUR_RETURN_URL = 'https://example.com/return';
const returnUrl = await client.authenticate(STEAM_OPENID_URL, OUR_RETURN_URL);
Then, if user logged in and we grab the return URL, we can verify it:
const userResponseUrl = 'https://example.com/return?openid.assoc_handle=123&openid.signed=signed_stuff&openid.sig=signature&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fsteamcommunity.com%2Fopenid%2Flogin&openid.claimed_id=https%3A%2F%2Fsteamcommunity.com%2Fopenid%2Fid%2F12345678912345678&openid.identity=https%3A%2F%2Fsteamcommunity.com%2Fopenid%2Fid%2F12345678912345678&openid.return_to=https%3A%2F%2Fexample.com%2Freturn&openid.response_nonce=nonce&openid.assoc_handle=123&openid.signed=signed_stuff&openid.sig=signature';
const verified = await client.verifyResponse(userResponseUrl, OUR_RETURN_URL);
Adjust to your own OpenID 2.0 flow. You can use two methods:
authenticate
- to generate URL for user to loginverifyResponse
- to verify user response
To run tests:
npm run test
1.0.24
9 months ago
1.0.23
9 months ago
1.0.22
9 months ago
1.0.21
9 months ago
1.0.20
9 months ago
1.0.19
9 months ago
1.0.18
9 months ago
1.0.17
9 months ago
1.0.16
9 months ago
1.0.15
9 months ago
1.0.14
9 months ago
1.0.13
9 months ago
1.0.12
9 months ago
1.0.11
9 months ago
1.0.10
9 months ago
1.0.9
9 months ago
1.0.8
9 months ago
1.0.7
9 months ago
1.0.6
9 months ago
1.0.5
9 months ago
1.0.4
9 months ago
1.0.3
9 months ago
1.0.2
9 months ago
1.0.1
9 months ago
1.0.0
9 months ago