
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@endpass/endpass-node
Advanced tools
Install client with your favorite package manager. For example with yarn
:
yarn add endpass-node
Or with npm
:
npm i --save endpass-node
This library allows to use endpass public API. Before requesting you should create your owl application at Vault and create client.
For example, we want to create client for requesting user data:
const { Client } = require('endpass-node');
const client = new Client({
clientId: '<your_application_id>',
clientSecret: '<your_application_secret>',
scopes: ['user:email:read', 'user:phone:read'],
state: '<random_string>',
redirectUrl: '<your_application_redirect_url>',
});
You can generate authorization code with getAuthUrl
method and redirect user for receive
authorization code, which can be used for access token requesting.
When you will receive authorization code you can try to request access token and make some requests with that:
const token = await client.exchange('<authorization_code>');
try {
const { email } = await client.request({
path: '/user',
accessToken: token.accessToken,
});
// There would be profile data
} catch (err) {
// Error handling
}
Also, you can create EndpassRequester
instance for multiple requests with one access token:
const token = await client.exchange('<authorization_code>');
const requester = client.createRequester(token.accessToken);
try {
const { email } = await requester.request('/user');
// ...
// There would be profile data
} catch (err) {
// Error handling
}
In the case abow, your access token will be cached in requester instance. Do not forget about access token expiration!
Notice: endpass-node
client is not storing access tokens, you should solve it by
yourself.
Also, yor can check example application here.
Notice: all properties are required.
Property | Description |
---|---|
clientId | Oauth2 application client id |
clientSecret | Oauth2 application client secret |
scopes | Scopes which can be allowed to client requests |
redirectUrl | Redirect for receiving authorization code |
state | Unique string for validating OAuth2 responses |
Notice: you can find more information in the JSDOC notations for each method.
Method | Arguments | Returned value | Description |
---|---|---|---|
getAuthUrl | string | Returns url where user can receive authorization code for token requesting | |
exchange | code: string | Promise<Token> | Requests authorization token with authorization code |
refresh | refreshToken: string | Promise<Token> | Refresh authorization token with earlier received refresh token |
request | { origin?: string, path: string, accessToken: string } | Promise<object> | Request some data from endpass public API endpoint with access token |
FAQs
Endpass Connect client for node.js backend
We found that @endpass/endpass-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.