@j2inn/scram
v1.0.6
Published
TypeScript client SCRAM authentication library
Downloads
8,150
Readme
TypeScript client SCRAM authentication library
This library is used by clients wanting to authenticate with servers that use SCRAM (Salted Challenge Response Authentication Mechanism).
For more information on SCRAM, please see the specification.
Installation
npm install @j2inn/scram
Use
import authenticate from '@j2inn/scram'
...
async function onAuthenticate(username: string, password: string): void {
await authenticate({
username,
password,
uri: new URL('/auth', window.location.href)
})
}
An alternative fetch
parameter can be specified if this library is used in a NodeJS environment...
import fetch from 'node-fetch'
import authenticate from '@j2inn/scram'
...
async function onAuthenticate(username: string, password: string, uri: string): void {
await authenticate({
username,
password,
fetch,
uri
})
}