Skip to content

An example script that imports a collection of users into Keygen from a CSV dataset

License

Notifications You must be signed in to change notification settings

keygen-sh/example-csv-importer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example CSV Importer

This is an example of creating a quick Node script for importing user data from a CSV and creating user accounts and licenses within Keygen.

This example application is not 100% production-ready, but it should get you 90% of the way there. You may need to add additional logging, error handling, license key and temporary password email delivery, etc.

Running the example

First up, configure a few environment variables:

# Keygen product token (don't share this!)
export KEYGEN_PRODUCT_TOKEN="YOUR_KEYGEN_PRODUCT_TOKEN"

# Your Keygen account ID
export KEYGEN_ACCOUNT_ID="YOUR_KEYGEN_ACCOUNT_ID"

# The Keygen policy to use when creating licenses for new users
export KEYGEN_POLICY_ID="YOUR_KEYGEN_POLICY_ID"

You can either run each line above within your terminal session before starting the app, or you can add the above contents to your ~/.bashrc file and then run source ~/.bashrc after saving the file.

Next, install dependencies with yarn:

yarn

Then run the script to import the sample data from data/users.csv:

yarn start

Questions?

Reach out at support@keygen.sh if you have any questions or concerns!

About

An example script that imports a collection of users into Keygen from a CSV dataset

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published