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

hamuga-id-sdk

v0.1.11

Published

Hamuga ID SDK for React Native

Readme

hamuga-id-sdk

Hamuga ID SDK for React Native. Supports both New & Old Architecture.

English | Монгол


English

Installation

npm install hamuga-id-sdk

After installing the package, you need to install the native dependencies:

cd example/ios && pod install

Note for iOS: This library requires SafariServices.framework. The podspec links it automatically, but if you encounter issues, manually link it in Xcode's "Link Binary With Libraries" build phase.

Usage

This library provides two ways to initiate the Hamuga ID authentication flow:

1. HamugaAuthButton

A customizable button component that opens the authentication screen.

import { HamugaAuthButton } from 'hamuga-id-sdk';

// ...

<HamugaAuthButton
  baseUrl="https://your-auth-server.com"
  client_id="your-client-id"
  redirect_uri="your-app://callback"
  scope={['openid', 'email']}
/>;

2. hamugaIdOpen

A function to programmatically open the authentication screen.

import { hamugaIdOpen } from 'hamuga-id-sdk';

// ...

const handleLogin = () => {
  hamugaIdOpen({
    baseUrl: 'https://your-auth-server.com',
    client_id: 'your-client-id',
    redirect_uri: 'your-app://callback',
    scope: ['openid', 'email'],
    autoClose: true, // Optional: automatically closes browser on redirect match
  });
};

Utility Functions

buildAuthUrl

Constructs the authentication URL without opening the browser.

import { buildAuthUrl } from 'hamuga-id-sdk';

const url = buildAuthUrl({
  baseUrl: '...',
  client_id: '...',
  redirect_uri: '...',
  scope: ['openid'],
});

getAuthCodeFromUrl

Extracts the code parameter from a redirect URL.

import { getAuthCodeFromUrl } from 'hamuga-id-sdk';

const code = getAuthCodeFromUrl(url);

Props

AuthProps

Available for HamugaAuthButton, hamugaIdOpen, and buildAuthUrl.

| Prop | Type | Default | Description | | --------------- | --------------------------------------------- | ------------ | ---------------------------------------- | | baseUrl | string | | Base URL of your authentication server. | | client_id | string | | Your client ID. | | redirect_uri | string | | URI to redirect to after authentication. | | scope | ('openid' \| 'email' \| 'phone' \| 'dan')[] | ['openid'] | Scopes to request. | | state | string | '123' | Random string to prevent CSRF. | | response_type | string | 'code' | Response type. | | username | 'phone' \| 'email' | | Prefilled username type. | | autoClose | boolean | true | Auto-close browser on redirect match. |

ButtonProps

Available only for HamugaAuthButton.

| Prop | Type | Default | Description | | ----------- | ----------- | ----------------------- | ------------------------ | | title | string | 'Хамуга ID-р нэвтрэх' | Button text. | | style | ViewStyle | | Button container styles. | | textStyle | TextStyle | | Button text styles. |


Монгол

Суулгах

npm install hamuga-id-sdk

Багцыг суулгасны дараа native сангуудыг суулгах шаардлагатай:

cd example/ios && pod install

iOS-д зориулсан тэмдэглэл: Энэхүү сан нь SafariServices.framework-ийг ашигладаг. Podspec үүнийг автоматаар холбодог боловч асуудал гарвал Xcode-ийн "Link Binary With Libraries" хэсэгт гараар нэмээрэй.

Хэрэглээ

Hamuga ID-р нэвтрэх урсгалыг эхлүүлэх хоёр арга бий:

1. HamugaAuthButton

Нэвтрэх цонхыг нээх товчлуур бүхий компонент.

import { HamugaAuthButton } from 'hamuga-id-sdk';

// ...

<HamugaAuthButton
  baseUrl="https://your-auth-server.com"
  client_id="your-client-id"
  redirect_uri="your-app://callback"
  scope={['openid', 'email']}
/>;

2. hamugaIdOpen

Нэвтрэх цонхыг програмын аргаар нээх функц.

import { hamugaIdOpen } from 'hamuga-id-sdk';

// ...

const handleLogin = () => {
  hamugaIdOpen({
    baseUrl: 'https://your-auth-server.com',
    client_id: 'your-client-id',
    redirect_uri: 'your-app://callback',
    scope: ['openid', 'email'],
    autoClose: true, // Сонголтоор: Redirect таарвал хөтөчийг автоматаар хаана
  });
};

Туслах функцууд

buildAuthUrl

Хөтөч нээхгүйгээр нэвтрэх URL-ийг үүсгэнэ.

import { buildAuthUrl } from 'hamuga-id-sdk';

const url = buildAuthUrl({
  baseUrl: '...',
  client_id: '...',
  redirect_uri: '...',
  scope: ['openid'],
});

getAuthCodeFromUrl

Redirect URL-аас code параметрийг салгаж авна.

import { getAuthCodeFromUrl } from 'hamuga-id-sdk';

const code = getAuthCodeFromUrl(url);

Пропсууд

AuthProps

HamugaAuthButton, hamugaIdOpen, болон buildAuthUrl-д боломжтой.

| Проп | Төрөл | Өгөгдмөл | Тайлбар | | --------------- | --------------------------------------------- | ------------ | ------------------------------------------- | | baseUrl | string | | Authentication серверийн хаяг. | | client_id | string | | Таны client ID. | | redirect_uri | string | | Амжилттай нэвтэрсний дараа буцах хаяг. | | scope | ('openid' \| 'email' \| 'phone' \| 'dan')[] | ['openid'] | Хүсч буй эрхүүд. | | state | string | '123' | CSRF-ээс сэргийлэх санамсаргүй текст. | | response_type | string | 'code' | Хариуны төрөл. | | username | 'phone' \| 'email' | | Урьдчилан бөглөх хэрэглэгчийн нэрний төрөл. | | autoClose | boolean | true | Redirect таарвал хөтөчийг автоматаар хаах. |

ButtonProps

Зөвхөн HamugaAuthButton-д боломжтой.

| Проп | Төрөл | Өгөгдмөл | Тайлбар | | ----------- | ----------- | ----------------------- | ------------------------------- | | title | string | 'Хамуга ID-р нэвтрэх' | Товчлуур дээрх текст. | | style | ViewStyle | | Товчлуурын савны загвар. | | textStyle | TextStyle | | Товчлуур дээрх текстийн загвар. |


Contributing

See the contributing guide to learn how to contribute.

License

MIT


Made with create-react-native-library