1.0.8 • Published 1 year ago
@pomelo-la/sdk-cards-be v1.0.8
SDK Backend for NodeJS
Overview
This library allows you to easily integrate with our services in order to obtain the end user token. Thus, you should embed the provided code into your backend by providing a single endpoint.
Requirements
You must be registered as a client in Pomelo and have the credentials configured (client_id and client_secret). We recommend storing the credentials with a secure mechanism, for example aws secret manager or other.
Integration
Installation
- Run the following command:
npm i --save @pomelo-la/sdk-cards-be
Usage
- Creating an instance:
import { SdkCards } from '@pomelo-la/sdk-cards-be';
const sdkCards = SdkCards.configure({
client_id: 'YOUR_CLIENT_ID',
client_secret: 'YOUR_CLIENT_SECRET',
non_prod_env: true
});
- You must provide the following parameters:
- CLIENT_ID and CLIENT_SECRET that we mention in Requirements
- non_prod_env allows you to configure the non-production environment and perform the tests in stage.
- invoking the get token service:
const token = await sdkCards.tokenService.getToken('USER_ID');
finally, you will get the end user token with the following format:
{
"access_token": "jwt",
"expires_in": 900,
"token_type": "Bearer"
}