Socket
Socket
Sign inDemoInstall

stytch

Package Overview
Dependencies
Maintainers
8
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stytch - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0-beta.1

dist/client.js

43

package.json
{
"name": "stytch",
"version": "2.0.1",
"version": "3.0.0-beta.1",
"description": "A wrapper for the Stytch API",
"main": "lib/stytch.js",
"types": "./index.d.ts",
"types": "./types/lib/index.d.ts",
"main": "./dist/index.js",
"exports": {
"require": "./dist/index.js",
"import": "./module.mjs"
},
"files": [
"dist/**/*",
"types/**/*"
],
"repository": {

@@ -12,4 +20,6 @@ "type": "git",

"scripts": {
"build": "babel lib --out-dir dist --extensions '.ts' && tsc --declaration --outDir types --emitDeclarationOnly",
"lint": "eslint lib",
"test": "mocha --recursive"
"test": "jest",
"test-packages": "./test-packages/test.sh"
},

@@ -22,16 +32,19 @@ "author": "Stytch",

"devDependencies": {
"chai": "^3.5.0",
"eslint": "^3.18.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.10.3",
"mocha": "^5.2.0",
"sinon": "^11.1.1"
"@babel/cli": "^7.14.5",
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/preset-typescript": "^7.14.5",
"@types/jest": "^26.0.23",
"@types/node": "^15.12.4",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"eslint": "^7.29.0",
"jest": "^27.0.5",
"prettier": "2.3.1",
"ts-jest": "^27.0.3",
"typescript": "^4.3.4"
},
"dependencies": {
"axios": "^0.21.1",
"moment": "^2.17.1",
"request": "^2.55.0",
"tsc": "^1.20150623.0"
"request": "^2.55.0"
},

@@ -38,0 +51,0 @@ "eslintConfig": {

# stytch-node
The Stytch Node library provides support for the Stytch API for server-side Javscript applications. You can find out more about the Stytch API at
The Stytch Node library provides support for the Stytch API for server-side Javscript
applications. You can find out more about the Stytch API at
[stytch.com/docs](https://stytch.com/docs).
If you're looking for frontend support for our Javascript SDK, check out [stytch-js](https://www.npmjs.com/package/@stytch/stytch-js).
If you're looking for frontend support for our Javascript SDK, check out
[stytch-js](https://www.npmjs.com/package/@stytch/stytch-js).
## Quickstart
Install stytch

@@ -14,35 +17,34 @@ ```

Example `login_or_create` usage
Run `login_or_create` to send a magic link by email:
```javascript
import Stytch from 'stytch';
import * as stytch from "stytch";
// Or as a CommonJS module:
// const stytch = require("stytch");
const stytchClient = new Stytch.Client({
const client = new stytch.Client({
project_id: "PROJECT_ID",
secret: "SECRET",
env: Stytch.envs.test
secret: "SECRET",
env: stytch.envs.test,
});
client.magicLinks.email
.loginOrCreate({
email: "sandbox@stytch.com",
login_magic_link_url: "http://localhost:8000/login",
signup_magic_link_url: "http://localhost:8000/signup",
})
.then((res) => console.log(res))
.catch((err) => console.error(err));
const loginOrCreateWithMagicLink = async () => {
const params: Stytch.loginOrCreateRequest = {
email: 'sandbox@stytch.com',
login_magic_link_url: 'https://www.stytch.com/login',
signup_magic_link_url: 'https://www.stytch.com/signup',
};
client.magicLinks
.authenticate("TOKEN FROM EMAIL")
.then((res) => console.log(res))
.catch((err) => console.error(err));
```
const response: Stytch.loginOrCreateResponse = await stytchClient.loginOrCreate(params);
## Documentation
console.log(response);
};
const authenticateMagicLink = async (token) => {
const response: Stytch.authenticateMagicLinkResponse = await stytchClient.authenticateMagicLink(token);
console.log(response);
};
loginOrCreateWithMagicLink().then().catch(err => console.log(err));
authenticateMagicLink('token from email').then().catch(err => console.log(err));
```
You can find all the documentation at https://stytch.com/docs, including an
[API reference](https://stytch.com/docs/api) with example usage for every endpoint. We also
maintain a set of [example apps](https://stytch.com/docs/example-apps) to start development from.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc