@adastradev/user-management-sdk
TypeScript icon, indicating that this package has built-in type declarations

5.0.3 • Public • Published

user-management-sdk-js

codecov

Ad Astra user management SDK for JavaScript in the browser and Node.js

Tools

AuthManager (Class)

The AuthManager class can be used to:

Sign in a user through AWS's managed Cognito identity provider

.signIn( email, password, newPassword = '' ) => Promise -> CognitoUserSession

Used to obtain a CognitoUserSession.

Get/refresh credentials, and set environment credentials with one function

.getAndSetEnvironmentCredentials() => Promise -> CognitoIdentityCredentials

This will set the following environment variables from the CognitoIdentityCredentials object:

process.env.AWS_ACCESS_KEY_ID
process.env.AWS_SECRET_ACCESS_KEY
process.env.AWS_SESSION_TOKEN

This function is equivalent to:

const creds = await authManagerInstance.refreshCognitoCredentials();
authManagerInstance.setEnvironmentIAMCreds(creds);
Get/refresh cognito credentials, and federated identity credentials

.refreshCognitoCredentials() => Promise -> CognitoIdentityCredentials

Returns a promise which resolves a fresh CognitoIdentityCredentials object after signing in.

Set credentials in the environment

.setEnvironmentIAMCreds(creds: CognitoIdentityCredentials) => void

This will set the following environment variables from the CognitoIdentityCredentials object:

process.env.AWS_ACCESS_KEY_ID
process.env.AWS_SECRET_ACCESS_KEY
process.env.AWS_SESSION_TOKEN

/@adastradev/user-management-sdk/

    Package Sidebar

    Install

    npm i @adastradev/user-management-sdk

    Weekly Downloads

    440

    Version

    5.0.3

    License

    MIT

    Unpacked Size

    62.8 kB

    Total Files

    33

    Last publish

    Collaborators

    • jamiander
    • cbratcher
    • anissakhan
    • chris-pham
    • mswanwick
    • sturner74
    • yakemomoses300
    • kagata
    • jmentzel
    • nduerksen
    • jcmq6b
    • bdietrich
    • m_pepperman
    • bgswilde
    • dhoang_2dastars
    • rdhrty
    • lbrown1591
    • lsanders
    • mdarps_aais
    • aneihouse
    • chewbone
    • amburch08
    • rugernpm
    • jvanderpool
    • mbourret
    • kyledrowan
    • blackwidow-sa
    • rarms
    • jwiebe17
    • chrisalt_aais
    • mbourret2
    • alejandrom24
    • lskinner
    • mholladay
    • froberts-aais
    • bleppke
    • bdaubry
    • jjacobson