pingone-getbyuserid
v1.0.1
Published
A library for getting user info by passing ID of pingOne API
Downloads
10
Maintainers
Readme
PingOne User Info Library
A Node.js library for retrieving user information from PingOne API using the user ID.
Installation
You can install this library via npm:
npm install pingone-getbyuserid
Usage
const PingOneUser = require('pingone-getbyuserid');
// Replace these values with your actual client ID, client secret, token URL, and environment ID
const clientId = 'YOUR_CLIENT_ID';
const clientSecret = 'YOUR_CLIENT_SECRET';
const tokenUrl = 'YOUR_TOKEN_URL'; // Replace with your token URL
const environmentId = 'YOUR_ENVIRONMENT_ID'; // Replace with your environment ID
const userId = 'USER_ID'; // Replace with the actual user ID you want to retrieve
async function getUserInfo() {
try {
const pingOneUser = new PingOneUser(clientId, clientSecret, tokenUrl, environmentId);
const userData = await pingOneUser.getUserById(userId);
console.log('User Data:', userData);
} catch (error) {
console.error('Error:', error.message);
}
}
getUserInfo();
API
PingOneUser(clientId, clientSecret, tokenUrl, environmentId)
Creates a new instance of the PingOneUser class with the provided client ID, client secret, token URL, and environment ID.
clientId (string): Your PingOne client ID.
clientSecret (string): Your PingOne client secret.
tokenUrl (string): The URL to fetch the access token from.
environmentId (string): The ID of the PingOne environment.
getUserById(userId)
Fetches user information from PingOne API using the provided user ID.
userId (string): The ID of the user to retrieve information for.
Returns a promise that resolves with the user data object.