Skip to content

djsd123/auth0-bulk-user-exports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auth0 Bulk User Exports

Query Auth0's API and export data in csv format to either local file system or an S3 bucket

Prerequisites

  • OIDC Client ID
  • OIDC Client Secret
  • Go version 1.13

You'll need to have an auth0 application in order to retrieve these values

Note

This app requests temporary credentials every time it executes. You'll need to ensure the resulting bearer tokens have the following scopes

  • create:client_grants
  • read:client_grants
  • read:connections
  • read:users

Usage

go run main.go
Or
GOOS=linux go build -o auth0-bulk-user-export
./auth0-bulk-user-exports
Or
docker image build -t auth0-bulk-user-exports .
docker container run -it --rm -v /tmp:/tmp --env CLIENT_ID=41Tmoz00wBN1... --env CLIENT_SECRET=StdNYnUaPuv9iMEfKsiLEZ0GUTe... --name auth0-bulk-user-exports auth0-bulk-user-exports

Write data to local file: ~/Dowloads/userdata.csv

export CLIENT_ID="41Tmoz00wBN1..."
export CLIENT_SECRET="StdNYnUaPuv9iMEfKsiLEZ0GUTe...."
export FILE_PATH="~/Dowloads/userdata.csv"

Write to S3

export CLIENT_ID="41Tmoz00wBN1..."
export CLIENT_SECRET="StdNYnUaPuv9iMEfKsiLEZ0GUTe...."
export ENV=aws
export BUCKET=my-bucket

Using SSM

export SSM_PATH=/my/ssm/params/path/secrets/
export ENV=aws
export BUCKET=my-bucket

Configuration

Env Variable Default Description
CLIENT_ID (Required) The Client ID of the auth0 application used for this app
CLIENT_SECRET (Required) The Client Secret of the auth0 application used for this app
SSM_PATH SSM Parameter Path to retrieve CLIENT_ID and CLIENT_SECRET values. Required If CLIENT_ID and CLIENT_SECRET environment variables are unset
API_URL (Required) Auth0 management API endpoint i.e. https://DOMAIN.eu.auth0.com
CONNECTION_NAME github Config param for auth0. Which connection to target when querying the API (https://auth0.com/docs/identityproviders)
ENV (Write Data Locally) Do not set to write locally or set to aws to write data to S3
ROLE_ARN The IAM role arn this app uses to write to S3 and fetch ssm parameters
FILE_PATH /tmp/userdata.csv File path when writing locally. Only works when ENV is not set
BUCKET auth0-bulk-user-exports The S3 bucket to write to when ENV=aws is set. The resulting key will be suffixed with the date i.e userdata-22-09-2019
JOB_CONFIG_FILE job_config.json Define what user Attributes to export

Test

To run tests, cd to the root of this project

go test ./...

About

Export user data from auth0

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published