Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
XOAuth2 token generation with node.js
npm install xoauth2
xoauth2 generates XOAUTH2 login tokens from provided Client and User credentials.
Use xoauth2.createXOAuth2Generator(options)
to initialize Token Generator
Possible options values:
Authorization: Basic Base64(clientId:clientSecret)
See https://developers.google.com/identity/protocols/OAuth2WebServer#offline for generating the required credentials
For Google service account the option values are:
Use xoauth2obj.getToken(callback)
to get an access token. If a cached token is found and it should not be expired yet, the cached value will be used.
Use xoauth2obj.generateToken(callback)
to get an access token. Cache will not be used and a new token is generated.
Use xoauth2obj.updateToken(accessToken, timeout)
to set the new value for the xoauth2 access token. This function emits 'token'
If a new token value has been set, 'token'
event is emitted.
xoauth2obj.on("token", function(token){
console.log("User: ", token.user); // e-mail address
console.log("New access token: ", token.accessToken);
console.log("New access token timeout: ", token.timeout); // TTL in seconds
});
var xoauth2 = require("xoauth2"),
xoauth2gen;
xoauth2gen = xoauth2.createXOAuth2Generator({
user: "user@gmail.com",
clientId: "{Client ID}",
clientSecret: "{Client Secret}",
refreshToken: "{User Refresh Token}",
customHeaders: {
"HeaderName": "HeaderValue"
},
customPayload: {
"payloadParamName": "payloadValue"
}
});
// ... or for a Google service account
xoauth2gen = xoauth2.createXOAuth2Generator({
user: "user@gmail.com",
service: '{Service Email Address}',
scope: 'https://mail.google.com/',
privateKey: '{Private Key in PEM format}'
});
// SMTP/IMAP
xoauth2gen.getToken(function(err, token){
if(err){
return console.log(err);
}
console.log("AUTH XOAUTH2 " + token);
});
// HTTP
xoauth2gen.getToken(function(err, token, accessToken){
if(err){
return console.log(err);
}
console.log("Authorization: Bearer " + accessToken);
});
MIT
v1.2.0 2016-07-29
FAQs
XOAuth2 token generation for accessing GMail SMTP and IMAP
The npm package xoauth2 receives a total of 13,075 weekly downloads. As such, xoauth2 popularity was classified as popular.
We found that xoauth2 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.