# multipass-js

> a shopify multipass url generator

Latest version **0.1.6** (published 2021-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install multipass-js
pnpm add multipass-js
yarn add multipass-js
bun add multipass-js
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2021-05-03 |
| First published | 2020-07-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | softmarshmallow |
| Maintainers | softmarshmallow |

## Links

- npm: https://www.npmjs.com/package/multipass-js
- Repository: https://github.com/softmarshmallow/multipass-js
- npm.io page: https://npm.io/package/multipass-js

## Recent versions

- 0.1.6 (latest) — 2021-05-03
- 0.1.5 — 2020-08-24
- 0.1.4 — 2020-07-29
- 0.1.3 — 2020-07-29
- 0.1.2 — 2020-07-29
- 0.1.1 — 2020-07-29
- 0.1.0 — 2020-07-29

## README

# multipass-js
a typesafe shopify multipass token generator, written in 100 pure typescript

> [Shopify](http://shopify.com) provides a mechanism for single sign-on known as Multipass.  Multipass uses an AES encrypted JSON hash and multipassify provides functions for generating tokens

> More details on Multipass with Shopify can be found [here](http://docs.shopify.com/api/tutorials/multipass-login).



## installation

```shell
# isntall with yarn
yarn add multipass-js

# install with npm
npm install multipass-js
```



## usages
``` typescript
import { Multipass } from "multipass-js"
const multipass = new Multipass(SHOPIFY_STORE_MULTIPASS_SECRET);

// Create your customer data hash
const email = `woojoo@softmarshmallow.com`
const customerData = {
    email: email,
    user: "your database user id",
    customer: "any custom data you want"
    // ...
};


const url = multipass.withCustomerData(customerData).withDomain("mystore.shopify.com").withRedirect("products/primary").url();

// client may access shopify with `url`
// will give you URL like:  https://store.myshopify.com/account/login/multipass/<MULTIPASS-TOKEN>
// with optional redirection

// Generate token
const token = multipass.withCustomerData(customerData).token();
```


## Shopify docs
https://shopify.dev/docs/admin-api/rest/reference/plus/multipass

---
_Source: https://npm.io/package/multipass-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
