
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
A NodeJS library for authorizing a registered client against the Volontär-API
npm install volontar
const express = require('express')
const app = express()
const Client = require('volontar')
const myClient = new Client({
clientId: 'myClientId',
clientSecret: 'myClientSecret',
redirectUri: 'https://example.com/callback'
})
app.get('/signin', (req, res, next) => {
const authorizationUrl = myClient.authorize('user.read')
res.redirect(authorizationUrl)
})
app.get('/callback', async (req, res, next) => {
const authorizationCode = req.query.code
try {
const { accessToken } = await myClient.token(authorizationCode)
// Use accessToken
} catch(err) {
// Handle error
}
})
app.listen(8080)
new Client(opts)
Instantiate a new client
opts
required Options as an object{
clientId: String //required
clientSecret: String //required,
redirectUri: String //required
}
client.authorize(scope [, opts])
Generate an authorization-url for a scope as a String
to redirect users to
scope
required Must be a string containing at least one valid scope, multiple scopes are separated by spacesopts
optional Options as an object{
state: String //optional, defaults to 'none',
responseType: String //optional, defaults to 'code'
}
client.token(authorizationCode)
Obtain an access_token
and refresh_token
from an authorization_code
.
authorizationCode
required A valid authorization_code
as a string, normally retrieved from a query-parameter passed to the client's redirectUri
{
access_token: String, //JWT
access_token_expires_at: String, //Date
refresh_token: String,
refresh_token_expires_at: String //Date
scope: String //Accepted scopes, space-separated
}
client.refresh(refreshToken)
Obtain a new access_token
and refresh_token
.
refreshToken
required A valid refresh_token
as a string, normally obtained from a previous client.token()
call{
access_token: String, //JWT
access_token_expires_at: String, //Date
refresh_token: String,
refresh_token_expires_at: String //Date
scope: String //Accepted scopes, space-separated
}
MIT
FAQs
A library for NodeJS to authorize against Volontär
The npm package volontar receives a total of 3 weekly downloads. As such, volontar popularity was classified as not popular.
We found that volontar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.