![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
apple-music-token-node
Advanced tools
generate developer tokens for the apple music api in node, with a CLI mode for development.
use javascript to generate your developer tokens for use with the apple music api.
adapted from: https://github.com/pelauimagineering/apple-music-token-generator/blob/master/music_token.py
npm
npm install -S apple-music-token-node
yarn
yarn add apple-music-token-node
-or-
clone, download, or copy-paste this script somewhere in your node project.
if you don't want to use the async api available in v2, the only code change you need to make is to update from this:
const getToken = require('apple-music-token-node');
to this:
const { getToken } = require('apple-music-token-node');
and you're done!
if you would like to use the new async api, you can require it like so:
const { getTokenAsync } = require('apple-music-token-node');
getTokenAsync
takes the same arguments as getToken
, and returns a promise (and thus is usable with async
/await
). the promise resolves to the same object that would be returned by using getToken
.
make sure you've placed the .p8 private key file you generated somewhere accessible. also, include or require your teamId
and keyId
from apple.
synchronous usage:
const path = require('path');
const { getToken } = require('apple-music-token-node');
const { teamId, keyId } = require('./path-to-your-config');
const certPath = path.resolve(__dirname, './path-to-your-p8-file');
const tokenData = getToken(certPath, teamId, keyId);
// tokenData == { token: 'generated_token', expiresAt: timeInSeconds }
asynchronous usage:
const path = require('path');
const { getTokenAsync } = require('apple-music-token-node');
const { teamId, keyId } = require('./path-to-your-config');
const certPath = path.resolve(__dirname, './path-to-your-p8-file');
const generate = async () => {
const tokenData = await getTokenAsync(certPath, teamId, keyId);
// tokenData == { token: 'generated_token', expiresAt: timeInSeconds }
// ...
};
// -or-
const generate = () => {
getTokenAsync(certPath, teamId, keyId).then((tokenData) => {
// tokenData == { token: 'generated_token', expiresAt: timeInSeconds }
// ...
});
};
cli mode to help generate quick tokens during development. for this, install globally:
npm
npm i -g apple-music-token-node
yarn
yarn add -g apple-music-token-node
then you can run:
amtn
and it will prompt you for the data needed to generate your developer token. (prints to the console).
FAQs
generate developer tokens for the apple music api in node, with a CLI mode for development.
The npm package apple-music-token-node receives a total of 1,216 weekly downloads. As such, apple-music-token-node popularity was classified as popular.
We found that apple-music-token-node 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.