An example API app in Go that checks a user's WNT16 and FAM3C genes for unbreakable bones.
Clone the repository, and look at the .env
file to see what environment variables must be set.
Your env's REDIRECT_URI
must match the one on your developer dashboard at https://api.23andme.com/dashboard/. Locally you'll probably want http://localhost:PORT/receive_code/
.
I host the app on Heroku.
- Setup Go on Heroku: http://mmcgrana.github.com/2012/09/getting-started-with-go-on-heroku.html.
- Set environment variables on Heroku: https://devcenter.heroku.com/articles/config-vars.
I change CLIENT_ID
and CLIENT_SECRET
to match my API credentials, and delete the PORT
variable because Heroku sets it automatically.
heroku config:set CLIENT_ID=xxx
heroku config:set CLIENT_SECRET=xxx
heroku config:set COOKIE_SECRET=xxx
heroku config:set SESSION_NAME=api-example-bones
heroku config:set SESSION_ACCESS_TOKEN_KEY=xxx
heroku config:set REDIRECT_URI=http://yourapp.com/receive_code/
heroku config:unset PORT
Just set your environment variables, build the program, and run it:
go build
./api-example-bones