Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mapbox/parse-mapbox-token

Package Overview
Dependencies
Maintainers
223
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/parse-mapbox-token

Parse a Mapbox API token, in Node or the browser

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
82K
decreased by-43.94%
Maintainers
223
Weekly downloads
 
Created
Source

@mapbox/parse-mapbox-token

Build Status

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.

Installation

npm install @mapbox/parse-mapbox-token

Usage

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.

Keywords

FAQs

Package last updated on 07 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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