npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@scribelabsai/auth

v1.4.1

Published

Library to connect to Scribe's platform.

Downloads

20

Readme

Scribe Auth Node

Most calls to Scribe's API require authentication and authorization. This library simplifies this process.

You first need a Scribe account and a client ID. Both can be requested at support[atsign]scribelabs[dotsign]ai or through Intercom on https://platform.scribelabs.ai if you already have a Scribe account.

This library interacts directly with our authentication provider AWS Cognito meaning that your username and password never transit through our servers.

Installation

Add the dependency to your package.json and save it:

"dependencies": {
	"@scribelabsai/auth": ">=1.0.0"
}

Install it from command line:

npm install

Requirements

This library requires Node.js >= 16.20.0

Methods

1. Changing password

import { Auth, Tokens } from '@scribelabsai/auth';
const access = new Auth(clientId);
access.changePassword('username', 'password', 'newPassword');

2. Recovering an account in case of forgotten password

import { Auth, Tokens } from '@scribelabsai/auth';
const access = new Auth(clientId);
access.forgotPassword('username', 'password', 'confirmationCode');

3. Get or generate tokens

With username and password
import { Auth, Tokens } from '@scribelabsai/auth';
const access = new Auth(clientId);
access.getTokens({ username: 'username', password: 'password' });
With refresh token
import { Auth, Tokens } from '@scribelabsai/auth';
const access = new Auth(clientId);
access.getTokens({ refreshToken: 'refreshToken' });

4. Revoking a refresh token

Disclaimer: revokeToken(refreshToken) is not ready yet, you may use our Python lib or call AWS services directly.

5. Getting federated id

import { Auth, Tokens } from '@scribelabsai/auth';
const access = new Auth({
  clientId: your_client_id,
  userPoolId: your_user_pool_id,
  identityPoolId: your_identity_pool_id,
});
access.getFederatedId(your_id_token);

6. Getting federated credentials

import { Auth, Tokens } from '@scribelabsai/auth';
const access = new Auth({
  clientId: your_client_id,
  userPoolId: your_user_pool_id,
  identityPoolId: your_identity_pool_id,
});
access.getFederatedCredentials(your_federated_id, your_id_token);

7. Getting signature for request

import { Auth, Tokens } from '@scribelabsai/auth';
const access = new Auth({
  clientId: your_client_id,
  userPoolId: your_user_pool_id,
  identityPoolId: your_identity_pool_id,
});
access.getSignatureForRequest(your_request, your_credentials);

Flow

  • If you never have accessed your Scribe account, it probably still contains the temporary password we generated for you. You can change it directly on the platform or with the changePassword method. You won't be able to access anything else until the temporary password has been changed.

  • Once the account is up and running, you can request new tokens with getTokens. You will initially have to provide your username and password. The access and id tokens are valid for up to 30 minutes. The refresh token is valid for 30 days.

  • While you have a valid refresh token, you can request fresh access and id tokens with getTokens but using the refresh token this time, so you're not sending your username and password over the wire anymore.

  • You can get your federated id by using getFederatedId and providing your id token. The federated id will allow you to use getFederatedCredentials to get an access key id, secret key and session token.

  • Every API call to be made to Scribe's API Gateway needs to have a signature. You can get the signature for your request by using getSignatureForRequest. Provide the request you'll be using and your credentials (use getFederatedCredentials to get them).


To flag an issue, open a ticket on Github and contact us on Intercom through the platform.