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

expo-cafebazaar-auth

v1.0.1

Published

Cafe Bazaar In-App Login for Expo (Android). Sign in with Bazaar account in your Expo/React Native app.

Readme

expo-cafebazaar-auth

Expo native module for Cafe Bazaar In-App Login on Android only. Use Bazaar (Cafe Bazaar) account sign-in in your Expo / React Native app.

Requirements

  • Platform: Android only. This package does not include iOS native code.
  • Build: A development build is required. The module does not work in Expo Go (the native module will be null).
  • Prebuild: You must run npx expo prebuild (at least once) so the config plugin can copy the vendor and wire the Android project.

Installation

npx expo install expo-cafebazaar-auth
# or
npm install expo-cafebazaar-auth
yarn add expo-cafebazaar-auth
pnpm add expo-cafebazaar-auth

Setup

1. Add the config plugin

In app.json (or app.config.js), add "expo-cafebazaar-auth" to expo.plugins:

{
  "expo": {
    "plugins": ["expo-cafebazaar-auth"]
  }
}

2. Run prebuild and build

The plugin runs at prebuild time. It:

  • Copies the bundled CafeBazaarAuth vendor (core + auth) from the package into your project at .expo/cafebazaar-auth/CafeBazaarAuth.
  • Registers the :core and :auth projects in android/settings.gradle so the native module can depend on them.
  • Applies Gradle patches (SDK versions, etc.) so the vendor builds correctly.

Run prebuild, then build and run on Android:

npx expo prebuild --platform android
npx expo run:android

You can use npx expo run:android without a separate prebuild if your project is already configured; the plugin runs when the native project is generated or updated.

When the module is unavailable

The package uses requireOptionalNativeModule, so the default export may be null when:

  • The app is running in Expo Go (no custom native code).
  • The native module is not linked (e.g. missing plugin or prebuild).

On iOS, the package does not ship native code; the module is Android-only. In a multi-platform app, always guard usage:

  • Check Platform.OS === 'android' before calling Bazaar APIs.
  • Check that the default export is not null before calling any method (e.g. CafeBazaarAuth?.isBazaarInstalled() or an if (CafeBazaarAuth) { ... } block).

For multi-platform apps, a small wrapper service (e.g. services/bazaarAuth.ts) that checks platform and null and exposes a single API is recommended, so the rest of the app works on iOS and in Expo Go without the native module.

API

Import the default export and use the methods below. Guard with null checks as needed.

| Method | Returns | Description | | ------------------------------- | ---------------------------------------- | --------------------------------------------------------------------------- | | isBazaarInstalled() | boolean | Whether the Bazaar app is installed on the device. | | isNeededToUpdateBazaar() | boolean | Whether the Bazaar app needs to be updated for login. | | signInAsync() | Promise<{ accountId: string } \| null> | Start sign-in flow; resolves with account or null (e.g. user cancelled). | | signOutAsync() | Promise<void> | Sign out. | | getLastSignedInAccountAsync() | Promise<{ accountId: string } \| null> | Get the last signed-in account without starting a new flow. | | showInstallBazaar() | void | Open system UI to install Bazaar. | | showUpdateBazaar() | void | Open system UI to update Bazaar. |

Typical sign-in flow

  1. If the module is null or not on Android, do not show Bazaar login (or show a message that it is Android-only).
  2. If !isBazaarInstalled() → call showInstallBazaar().
  3. Else if isNeededToUpdateBazaar() → call showUpdateBazaar().
  4. Else → call signInAsync() and handle the returned account or null.

Example

import { Platform } from "react-native";
import CafeBazaarAuth from "expo-cafebazaar-auth";

if (Platform.OS !== "android" || !CafeBazaarAuth) {
  // Bazaar not available (iOS or Expo Go)
  return;
}

if (!CafeBazaarAuth.isBazaarInstalled()) {
  CafeBazaarAuth.showInstallBazaar();
} else if (CafeBazaarAuth.isNeededToUpdateBazaar()) {
  CafeBazaarAuth.showUpdateBazaar();
} else {
  const account = await CafeBazaarAuth.signInAsync();
  if (account) console.log("accountId", account.accountId);
}

TypeScript

Types are exported from the package:

import CafeBazaarAuth, { type BazaarAccount } from "expo-cafebazaar-auth";

BazaarAccount has an accountId: string field.

Troubleshooting

Build error: project could not find :core or :auth

The Android project expects the CafeBazaarAuth :core and :auth subprojects, but they are not at the path Gradle is using.

  1. Ensure expo-cafebazaar-auth is in expo.plugins in app.json.

  2. Run npx expo prebuild --platform android so the plugin runs and populates .expo/cafebazaar-auth/CafeBazaarAuth.

  3. In android/settings.gradle, the CafeBazaarAuth block should look like this (paths relative to the android folder):

    // CafeBazaarAuth (expo-cafebazaar-auth)
    include ':core'
    project(':core').projectDir = new File(settingsDir, '../.expo/cafebazaar-auth/CafeBazaarAuth/core')
    include ':auth'
    project(':auth').projectDir = new File(settingsDir, '../.expo/cafebazaar-auth/CafeBazaarAuth/auth')

    If you see ../vendor/CafeBazaarAuth or another path, replace it with ../.expo/cafebazaar-auth/CafeBazaarAuth as above and run prebuild again.

Build error: Unresolved reference for ir.cafebazaar (or similar)

The vendor was not copied or linked. Run npx expo prebuild so the plugin copies the bundled CafeBazaarAuth source and wires it. Ensure .expo/cafebazaar-auth/CafeBazaarAuth exists after prebuild.

References

| Resource | URL | | ----------------------------- | ------------------------------------------------------------------- | | Cafe Bazaar In-App Login docs | https://developers.cafebazaar.ir/fa/guidelines/feature/bazaar-login/in-app | | CafeBazaarAuth SDK (official) | https://github.com/cafebazaar/CafeBazaarAuth | | expo-cafebazaar-auth (npm) | https://www.npmjs.com/package/expo-cafebazaar-auth | | expo-cafebazaar-auth (GitHub) | https://github.com/ssshojaei/expo-cafebazaar-auth |

License

MIT. The bundled CafeBazaarAuth code (under vendor/CafeBazaarAuth) is from Cafe Bazaar’s CafeBazaarAuth repository; see that repo for its license and attribution.