Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trusted-accounts-sdk-node

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trusted-accounts-sdk-node - npm Package Compare versions

Comparing version 1.0.12 to 1.1.0

lib/config.js

24

package.json
{
"name": "trusted-accounts-sdk-node",
"type": "module",
"version": "1.0.12",
"version": "1.1.0",
"description": "A simple SDK for Trusted Accounts for NodeJS",
"main": "./dist/trustedClient.js",
"types": "./trusted-accounts-sdk-node.d.ts",
"main": "src/index.js",
"repository": {

@@ -13,5 +12,12 @@ "type": "git",

"scripts": {
"build": "tsc",
"prepublishOnly": "npm run build"
"build": "babel src -d lib"
},
"dependencies": {
"axios": "^1.7.7",
"cookie-parser": "^1.4.7"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0"
},
"keywords": [

@@ -27,9 +33,3 @@ "trusted accounts",

"author": "Ludwig Thoma",
"license": "MIT",
"dependencies": {
"openid-client": "^5.1.3"
},
"devDependencies": {
"typescript": "^4.0.0"
}
"license": "MIT"
}
# Trusted Accounts SDK for Node.js
### 1. Start the Validation Flow.
Place this code on your website to show a validation button that starts the validation process. Get your platform credentials by creating a developer account for free in the [**developer console**](https://developers.trustedaccounts.org/).
The **Trusted Accounts Node SDK** allows you to integrate **user verification** and **validation** into your Node.js application with minimal setup. It supports the **OIDC flow**, **dynamic redirects**, and **session management**.
```
## Installation
```bash
npm install --save trusted-accounts-sdk-node
```
### Setup
Get your platform credentials by creating a free developer account here: [**developer console**](https://developers.trustedaccounts.org/).
```typescript
import TrustedAccountsSDK from 'trusted-accounts-sdk-node';
const taClient = new TrustedAccountsSDK({
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
redirectUri: 'YOUR_REDIRECT_URL'
});
```
### Example Usage
#### Start the Validation Flow.
```typescript
import TrustedAccountsClient from 'trusted-accounts-sdk-node';

@@ -30,13 +48,19 @@

### 2. Handle the Callback
After the user completes the verification, they will be redirected back to your redirect URL. Place this code on your website at this url to handle this callback and get the Trusted ID.
### Handle the Callback
```typescript
app.get('/callback', async (req, res) => {
// Get the Trusted ID by passing the code_verifier
const trustedId = await trustedClient.handleCallback(req, code_verifier);
res.send('Verification completed! Trusted ID: ' + trustedId);
const trustedCallback = await taClient.handleCallback(req.originalUrl);
res.send(`Verification completed! Trusted ID: ${trustedCallback.trustedId}`);
});
```
### Retrieve User Data
```typescript
app.get('/user', async (req, res) => {
const user = await taClient.getUser('USER_TRUSTED_ID');
res.json(user);
});
```
**That's it!** You have successfully integrated Trusted Accounts on your platform! 🖖 Try validate yourself and then go to the user list in the [**developer console**](https://developers.trustedaccounts.org/) to find the newly validated user.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc