# @mapbox/parse-mapbox-token

> Parse a Mapbox API token, in Node or the browser

Latest version **0.2.0** (published 2018-06-07) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install @mapbox/parse-mapbox-token
pnpm add @mapbox/parse-mapbox-token
yarn add @mapbox/parse-mapbox-token
bun add @mapbox/parse-mapbox-token
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2018-06-07 |
| First published | 2018-05-13 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Mapbox |
| Maintainers | 1ec5, aaaandrea, aag6z, aarthykc, ajashton, akit, alianthes, aliceykuo, alinapaz, allanwalkerit, allieoop, allierowan, alulsh, amishas157, ampetr89, amyleew, anandthakker, andygol, angela.navarro, ansis, aparlato, apavani, apendleton, arunasank, asheemmamoowala, benjamintd, bhousel, bkowshik, boblannon, brendanmcfarland, brsbl, brunoabinader, bsrinivasa, bsudekum, camillacaros, camilo.sanin, captainbarbosa-mbx, caseymm, castledoor, charloyd, chaupow, chrisloer, chriswu42, cknouss, cmtoomey, colleenmcginnis, coxchapman, d-prukop, danieljh, danmactough, danpat, danpaz-mb, danswick, dasulit, davidtheclark, deniskoronchik, dgearhart, dhcole, dianeschulze, dnesbitt, dnomadb, dputtick, drboyer, dthompson, electrostat, elifitch, emilymcafee, emilymdubois, enf, ericdeveloper, eschow, fa7c0n, fabianguerra, flippmoke, franka, freenerd, friedbunny, geografa, ghoshkaj, gknisely, gretacb, guardiola31337, heyadam_mapbox, heystenson, hjudge, ian29, ingalls, isiyu, ivovandongen, jacquestardie, jayana, jc-clark, jcsg, jerrad, jfirebaugh, jim-martin, jinnycho503, jjanczyszyn, jmkiley, jordanwebb, jothirnadh, jrpruit1, jseppi, julianrex, kalimar, karenell, karenzshea, katydecorah, kdiluca, kellyoung, kepta, kevinkreiser, kilatsat, kkaefer, ksummerill, l-r, langstonsmith, lbud, lily-chai, lingoded, lizziegooding, lobenichou, lshig, lswang14, lukasmartinelli, lukaspaczos, lxbarth, lyzidiamond, macro-shen, maikyon, mal-wood, maning, manoharuss, mapbox-admin, mapbox-npm, mapsam, markmisener, mateov, matt.gosline, mattficke, mcwhittemore, miccolis, mikelmaron, millzpaugh, mollymerp, morgane, morganherlocker, mourner, mpozdnyakov, msirenko, mtirwin, nammala, natslaughter, nickcordella, nickidlugash, nickitaliano, nikhilprabhakar, nmargolis, norchard, normanb, oini, okoriep, oormilavinod, osana, otherwiseman, oxidase, paigemoody, pdgoodman, perrygeo, peterqliu, petersirota, planemad, poornibadrinath, pratikyadav, pt-44, pveugen, ramshackle-jamathon, rasagy, rclark, rcleedev, recursivefunk, rmrice, ruggeroaltair, ryan-baumann, s-heisler, sabaelhilo, sabzo, sadiew, saikia.abhishek, samanbb, samely, samfader, sbma44, scottschultz, scottsfarley93, seekely, sgillies, springmeyer, srividyacb, sugargreenbean, tapasweni-pathak, taziam, tcql, themarex, tmpsantos, tobrun, tony-cj, tonysun, trevorspecht, tridip1931, tristen, upendrayadav, vakila, vincents, virginiayung, willwhite, xianny, yhahn, yuffster, yuletide, zhuwenlong, zugaldia, zurihunter92 |
| Keywords | mapbox, api, parse, token |

## Links

- npm: https://www.npmjs.com/package/@mapbox/parse-mapbox-token
- Repository: https://github.com/mapbox/parse-mapbox-token
- Homepage: https://github.com/mapbox/parse-mapbox-token#readme
- Issues: https://github.com/mapbox/parse-mapbox-token/issues
- npm.io page: https://npm.io/package/@mapbox/parse-mapbox-token

## Dependencies (1)

- [base-64](https://npm.io/package/base-64.md) ^0.1.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2018-06-07
- 0.1.0 — 2018-05-13

## README

# @mapbox/parse-mapbox-token

[![Build Status](https://travis-ci.com/mapbox/parse-mapbox-token.svg?token=FB2dZNVWaGo68KZnwz9M&branch=master)](https://travis-ci.com/mapbox/parse-mapbox-token)

Parse a Mapbox API token, in any JS environment, including Node, browser, and React Native.

Learn about Mapbox API tokens by reading [Mapbox's API documentation](https://www.mapbox.com/api-documentation/#tokens).

## Installation

```
npm install @mapbox/parse-mapbox-token
```

## Usage

```js
var parseToken = require('@mapbox/parse-mapbox-token');
var parsed = parseToken('MY_MAPBOX_TOKEN');
var ownerId = parsed.user;
```

Returns an object representing the parsed token.
Properties vary depending on the type of token (public, secret, or temporary).

The following properties will always be present:

- **usage:** `pk`, `sk`, or `tk` (public, secret, or temporary).
- **user:** The ID of the token's owner.

The following properties may or may not be present:

- **authorization:** Authorization associated with the owner's account.
- **created:** Timestamp for the creation time of the token.
- **expires:** Timestamp for the expiration time of the token.
- **lastLogin:** Timestamp of the owner's last verified login.
- **scopes:** Array of scopes available to the token.
- **client:** OAuth client for which the token was granted.
- **impersonator:** ID of the user impersonating the account owner.

The token's payload is parsed with [`base-64`](https://github.com/mathiasbynens/base64).

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