Skip to content

A simple cURL wrapper that calls Auth0, retrieves a JWT and sticks the correct Authorization header for you

License

Notifications You must be signed in to change notification settings

Jenji/auth0-curl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

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://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

About

A simple cURL wrapper that calls Auth0, retrieves a JWT and sticks the correct Authorization header for you

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages