Socket
Socket
Sign inDemoInstall

@pxd-co/pxd-auth-popup

Package Overview
Dependencies
8
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @pxd-co/pxd-auth-popup

A react component that supply pxd auth client


Version published
Weekly downloads
5
decreased by-28.57%
Maintainers
3
Install size
183 kB
Created
Weekly downloads
 

Readme

Source

@pxd-co/pxd-auth-popup

pxd auth client를 제공하는 react 컴포넌트입니다.

설명

이 프로젝트는 pxd auth client를 제공하는 react 컴포넌트입니다. 현재 버전은 0.1.3입니다.

설치

프로젝트를 설치하려면, 저장소를 클론하고 의존성을 설치할 수 있습니다:

git clone git+https://github.com/pxd-xe-group/pxd-auth-popup.git
cd pxd-auth-popup
npm install

Custom Hook

이 프로젝트는 useLogin.tsxtokenUtils.ts 파일에서 다음 함수들을 제공합니다:

useLogin()

useLogin은 로그인 팝업을 관리하는 함수를 반환하는 훅입니다.

import { useLogin } from "./useLogin";

const { onLogin } = useLogin();
  • onLogin()
    • onLogin(auto: boolean)
    • onLogin 함수는 클릭 시 로그인 팝업을 엽니다. 이 함수는 auto라는 불리언 타입의 매개변수를 받습니다. auto가 true일 경우, 자동 로그인 URL로 팝업을 엽니다.
onLogin(true); // 자동 로그인 URL로 팝업을 엽니다.
onLogin(false); // 일반 로그인 URL로 팝업을 엽니다. (default)

Token Utils

getToken()

  • getToken 함수는 저장된 토큰을 가져옵니다. 이 함수는 매개변수가 필요하지 않습니다.
  • 이 함수는 저장된 토큰을 문자열로 반환합니다. 토큰이 없으면 null을 반환합니다.
import { getToken } from "./tokenUtils";

const token = getToken();

decodeToken()

  • decodeToken(token: string)
    • decodeToken 함수는 주어진 토큰을 디코드합니다. 이 함수는 문자열 타입의 토큰을 매개변수로 받습니다.
    • 이 함수는 디코드된 토큰 객체를 반환합니다. 토큰이 유효하지 않으면 오류를 던집니다.
import { decodeToken } from "./tokenUtils";

const decoded = decodeToken("your_token_here");

getDecodedToken()

  • 현재 쿠키 스토리지에 저장되어 있는 토큰을 가져와 디코드합니다.
  • 이 함수는 디코드된 토큰 객체를 반환합니다. 토큰이 유효하지 않으면 오류를 던집니다.
import { getDecodedToken } from "./tokenUtils";

const decodedToken = getDecodedToken();

기여

버그를 발견하거나 기능 요청이 있으면, GitHub 페이지에 이슈를 열어 주세요.

FAQs

Last updated on 03 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc