npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rn-zalo-toolkit

v0.2.1

Published

Zalo authentication for React Native. Wraps the official Android and iOS SDKs, resolves the iOS SDK through Swift Package Manager instead of CocoaPods, and guarantees every call settles.

Downloads

529

Readme

rn-zalo-toolkit

Đăng nhập Zalo cho React Native, dùng SDK chính hãng của Zalo trên cả Android và iOS.

Trên iOS, SDK Zalo được lấy qua Swift Package Manager, không qua CocoaPods.

import { login } from 'rn-zalo-toolkit'

const result = await login()
await sendToBackend(result.oauthCode)

Cài đặt

npm install rn-zalo-toolkit

Cần React Native 0.85 trở lên (New Architecture).

Android

Thêm app id vào android/gradle.properties:

zaloAppId=1234567890123456789

Xong. Không cần sửa MainApplication, MainActivity hay AndroidManifest.

iOS

Thêm 3 key vào Info.plist (thay 1234567890123456789 bằng app id của bạn):

<key>ZaloAppID</key>
<string>1234567890123456789</string>

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLName</key><string>zalo</string>
    <key>CFBundleURLSchemes</key>
    <array><string>zalo-1234567890123456789</string></array>
  </dict>
</array>

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>zalosdk</string>
  <string>zaloshareext</string>
</array>

Rồi thêm một dòng vào AppDelegate để nhận URL callback từ Zalo:

import RnZaloToolkit

func application(_ app: UIApplication, open url: URL,
                 options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
  if ZaloToolkit.handle(url: url, options: options) { return true }
  return false
}

Chi tiết đầy đủ: setup Android · setup iOS

Kiểm tra đã cấu hình đúng chưa, không cần build:

npx rn-zalo-toolkit-doctor

Dùng

import { login, ZaloError, ZaloErrorCode } from 'rn-zalo-toolkit'

async function signIn() {
  try {
    const result = await login()

    // Gửi oauthCode cho backend để backend đổi lấy token.
    await sendToBackend(result.oauthCode)
  } catch (error) {
    if (ZaloError.is(error, ZaloErrorCode.CANCELLED)) {
      return // user bấm huỷ, không phải lỗi
    }
    if (ZaloError.is(error, ZaloErrorCode.ZALO_NOT_INSTALLED)) {
      // gợi ý cài Zalo, hoặc gọi lại login({ via: 'web' })
    }
    throw error
  }
}

Mọi hàm đều reject bằng ZaloError với một code cố định, nên bạn xử lý được từng trường hợp mà không phải đọc chuỗi message.

Có gì trong package

  • login, logout, getProfile, refreshTokens, exchangeOAuthCode, isRefreshTokenValid
  • ZaloError với tập mã lỗi cố định
  • Mock cho jest: jest.mock('rn-zalo-toolkit', () => require('rn-zalo-toolkit/jest'))
  • CLI kiểm tra cấu hình: npx rn-zalo-toolkit-doctor

Phạm vi hiện tại là đăng nhập. Không có share, feed hay message.

Tài liệu

Nếu bạn muốn sửa hoặc đóng góp cho thư viện, ghi chú nội bộ giải thích lý do đằng sau các quyết định kỹ thuật.

Yêu cầu

| | | |---|---| | React Native | 0.85+ | | Android | minSdk 24 | | iOS | 15.1+ |

Giấy phép

Apache-2.0. SDK Zalo đi kèm theo giấy phép MIT của chính nó, xem ios/ZaloSDKBinary/Frameworks/LICENSE-ZaloSDK.