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

zmp-developer-token

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zmp-developer-token

If you're tired of copying the access token every 1 hour, this library is for you

  • 3.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
762
increased by3.25%
Maintainers
1
Weekly downloads
 
Created
Source

Zalo Mini App Developer Token

If you're tired of copying the access token every 1 hour, this library is for you

Setup

npm install -D zmp-developer-token

Usage

import { getDeveloperAccessToken } from "zmp-developer-token";
import api from "zmp-sdk";

async function getAccessToken() {
  await api.login();
  let token = await api.getAccessToken();
  if (token === "DEFAULT ACCESS TOKEN") {
    token = await getDeveloperAccessToken();
  }
  return token;
}

If you have multiple mini apps inside one domain, specify a unique namespace:

await getDeveloperAccessToken("my-app");

How does it work?

You need to provide a valid App ID (which provides the access token), App Secret (to get new tokens) and an initial Refresh Token (which will last many months, and keep renewed automatically until you lost it).

localStorage.setItem("zdt.appId", "");
localStorage.setItem("zdt.appSecret", "");
localStorage.setItem("zdt.refreshToken", "");

Only execute the above scripts inside Devtools > Console. Do not put it inside of your source code ☠️

License

Copyright (c) Zalo Group. and its affiliates. All rights reserved.

The examples provided by Zalo Group are for non-commercial testing and evaluation purposes only. Zalo Group reserves all rights not expressly granted.

FAQs

Package last updated on 17 Jul 2023

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