Installation

서버용 TomoIDV Client SDK 를 설치합니다. 반드시 서버 환경에서 사용해주십시오. (브라우저 지원 불가)

npm install --save tomo-idv-client-node

QuickStart

createClientAssertion 함수를 이용하여 clientAssertion을 만들 수 있습니다. 이 때 console로부터 발급 받은 Client ID, Secret key와 TomoIDV API의 도메인인 https://api.tomopayment.com (test 모드의 경우 https://test.tomopayment.com)이 필요합니다.

import { createClientAssertion, buildTokenRequest } from 'tomo-idv-client-node';

// Create client assertion JWT
const clientAssertion = createClientAssertion({
  client_id: 'your-client-id',
  secret_key: 'your-secret-key',
  base_url: 'base-url'
});

// Build token request
const { headers, body } = buildTokenRequest(clientAssertion);

생성된 headersbody로 Access Token 요청을 할 수 있습니다. client_assertion을 포함한 Client 요청에 대해 Access token을 발급합니다.

// Use the token request
const response = await fetch('<https://test.tomopayment.com/v1/oauth2/token>', {
  method: 'POST',
  headers: headers,
  body: body
});