Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
auth0-apns
Advanced tools
Readme
Apple APNS API v3 client (HTTP/2)
Node ~> 6
npm install auth0-apns
Fist create your APNS
instance, and avoid recreating it every time since it will cache the APNS token according to Apple Guidelines
const APNS = require('auth0-apns').APNS;
const apns = new APNS('{YOUR_APPLE_TEAM_IDENTIFIER}', { id: '{YOUR_APPLE_APN_KEY_ID}', pem: '{YOUR_APPLE_APN_KEY}'});
Then to send the notification you need to:
const notification = {
aps: { alert: 'A notification sent from apns.js' }
};
apns
.topic('{APNS_TOPIC}')
.send(notification, '{DEVICE_TOKEN}')
.then(response => console.log(response))
.catch(error => console.error(error));
For more info on these values please check https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9
By default apns.js uses the production
endpoint but you can easily change it when building the topic:
const APNS = require('auth0-apns').APNS;
const apns = new APNS('{YOUR_APPLE_TEAM_IDENTIFIER}', { id: '{YOUR_APPLE_APN_KEY_ID}', pem: '{YOUR_APPLE_APN_KEY}'});
apns
.topic('{APNS_TOPIC}', 'development')
If APNS API returns an error, apns.js will wrap in APNSError class, where the name will hold the reason
code for the failure.
Also all possible reasons are declared in APNS.Reasons.{Error}
const APNSError = require('auth0-apns').APNSError;
console.log(APNSError.Reasons.BadCollapseId.name);
console.log(APNSError.Reasons.BadCollapseId.message);
so you could check the errors like
apns
.topic('{APNS_TOPIC}')
.send(notification, '{DEVICE_TOKEN}')
.then(response => console.log(response))
.catch(error => {
if (error.name == APNSError.Reasons.Unregistered.name) {
console.log('User unregisteded decice from APNS');
} else {
console.error(error);
}
});
Auth0 helps you to:
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
This project is licensed under the MIT license. See the LICENSE file for more info.
FAQs
Apple APNS API v3 client (HTTP/2)
The npm package auth0-apns receives a total of 2 weekly downloads. As such, auth0-apns popularity was classified as not popular.
We found that auth0-apns 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.