@heneise/auth0-get-token
Getting an access token for your API
Last updated a year ago by patrickheneise .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @heneise/auth0-get-token 
SYNC missed versions from official npm registry.

Build Status

Auth0 Token

Getting an access token for your API.

This can be used for integration testing, to dynamically obtain tokens when needed. No hardcoded accessTokens, no mocking.

Auth0 Setup

auth0 grant settings

  • In your Auth0 Dashboard create a new API if you didn't already do so (you can copy the API Identifier right away and paste into the config)
  • Head over to "Applications", there should be a Machine-to-Machine application with the same name as your API and "(Test Application)"
  • Click on the Test Application to see the settings
  • In the very bottom, click "Show Advanced Settings"
  • Go to the tab "Grant Types"
  • Select "Password" (this enables user/password requests for this library)

Usage

From the auth0 API, copy:

  • API IDENTIFIER (ie. "auth0-get-token") as AUTH0_AUDIENCE

From the auth0 Application, copy:

  • Domain as AUTH0_BASE_URL (add https://)
  • Client ID as AUTH0_CLIENT_ID
  • Client Secret as AUTH0_CLIENT_SECRET

Then, you can retrieve a token:

const getToken = require('auth0-get-token')
const tokens = await getToken('username', 'test-password')

Current Tags

  • 1.0.1                                ...           latest (a year ago)

2 Versions

  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
  • r2 ^2.0.1
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |