Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

Latest commit

 

History

History

curl-auth0

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

auth0-curl

Adapted from https://github.com/Jenji/auth0-curl

A simple curl wrapper that calls Auth0 (more specifically /oauth/ro), retrieves a JWT and sticks the correct Authorization header for you. Any argument is passed to curl, see the source.

Setup

  • Edit the script and replace the 4 environment variables (AUTH0_DOMAIN, AUTH0_CLIENTID, AUTH0_USERNAME, AUTH0_PASSWORD) with your Auth0 setup
  • Install jq, a very nice JSON parser

Usage

Exactly like you would use curl, no restrictions.

curl-auth0 -vvv -X GET 'http:https://localhost:8080/my-api'

How it works

Behind the scenes, this will do:

  1. a call to Auth0 /oauth/ro
  2. get the result (a JWT) that looks like this: {"id_token":"xxx.yyy.zzz","access_token":"aaaaaaaaaaaaaaaa","token_type":"bearer"}
  3. extract the id_token from the JWT
  4. call curl with the args you supplied to curl-auth0, and add the Authorization: Bearer ${id_token} header