trusted-accounts-sdk-node
Advanced tools
Comparing version 1.0.12 to 1.1.0
{ | ||
"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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10968
14
226
65
2
2
1
+ Addedaxios@^1.7.7
+ Addedcookie-parser@^1.4.7
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.7(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcookie@0.7.2(transitive)
+ Addedcookie-parser@1.4.7(transitive)
+ Addedcookie-signature@1.0.6(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
- Removedopenid-client@^5.1.3
- Removedjose@4.15.9(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedobject-hash@2.2.0(transitive)
- Removedoidc-token-hash@5.0.3(transitive)
- Removedopenid-client@5.7.1(transitive)
- Removedyallist@4.0.0(transitive)