Skip to content

Instantly share code, notes, and snippets.

@Tanver-Hasan
Last active December 7, 2018 11:36
Show Gist options
  • Save Tanver-Hasan/bc5744a33f0ab95a36a9a317b3656772 to your computer and use it in GitHub Desktop.
Save Tanver-Hasan/bc5744a33f0ab95a36a9a317b3656772 to your computer and use it in GitHub Desktop.
# Generate Token
# https://auth0.com/docs/api/authentication#client-credentials
curl --request POST \
--url 'https://tanver.au.auth0.com/oauth/token' \
-H 'content-type: application/json' \
-d '{"grant_type":"client_credentials","client_id": "[client id]","client_secret": "[client secret]","audience": "https://[domain].auth0.com/api/v2/"}'
#Find Connection
# https://auth0.com/docs/api/management/v2#!/Connections/get_connections
curl --request GET \
--url "https://[domain].auth0.com/api/v2/connections" \
-H "Content-Type: application/json" \
-H "Authorization:Bearer [Token]"
# Create Jobs
# https://auth0.com/docs/api/management/v2#!/Jobs/post_users_exports
# Copy the job id
curl --request POST \
--url 'https://[domain].auth0.com/api/v2/jobs/users-exports' \
-H "Authorization:Bearer [Token]" \
-H "Content-Type: application/json" \
-d '{"format":"json","connection_id":"[Connection id]","fields":[{"name":"email"},{"name":"identities[0].connection"},{"name":"created_at"}]}'
# Get Jobs
# https://auth0.com/docs/api/management/v2#!/Jobs/get_jobs_by_id
curl --request GET \
--url "https://[domain].auth0.com/api/v2/jobs/[Job id]" \
-H "Authorization:Bearer [Token]" \
-H "Content-Type: application/json" \
#Finally the get jobs call should return location field. Open the location in the browser. It should download the data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment