See this repo, which makes this much simpler: https://gist.github.com/giggio/8b326bf9bf3f2801f1d57e02d5ec3bea