Get the Now authentication token generated by the Now CLI in Node or from the command line.
This should make it much easier to work with the Now API. Note that in order to use this, you will either have to:
- Install the Now CLI (
npm i -g now-cli) and run
now login; or
- Set the
How it works
The Now CLI stores tokens in
~/.now/auth.json under the
credentials array, which should only have one entry in it unless you've authenticated with other providers. (Now refers to their own authentication provider as
NOW_TOKEN environment variable is not empty, we just return that.
This module exports a single function that resolves to your Now authentication token:
const nowToken =const fetch =
See below for available options.
npm install now-token, you'll get a
now-token executable in your npm bin.
Any of the available options can be passed to the
now-token executable by prefixing it with
||Get the token for a provider other than Now||