home/
developer portal/
authentication guide

BitGo Developer Portal

Authentication Guide

The first step in using the BitGo SDK is acquiring an API access token. This token will authenticate your BitGo SDK requests with BitGo’s servers and give you access to all of the SDK’s functionality. This guide assumes you’ve already successfully created an account on test.bitgo.com, logged into your account, and followed the steps in our installation guide. BitGo’s test and production environment are equivalent, except that each has its own set of user accounts, and test.bitgo.com uses the testnet blockchain while bitgo.com uses the mainnet blockchain.

Starting out at the test.bitgo.com’s dashboard:

Authentication Guide image 1


Click on the gear up in the top right corner next to your email address to go to the Settings page:


Authentication Guide image 2


From the Settings page, click on the API Access tab, and then click on the Add Access Token button:


Authentication Guide image 3


You’ll then be asked to enter information about what privileges/restrictions your access token should have. These are most useful when you need to share your token with another developer, but don’t want that developer having full access to the wallets on your account. Note that since we are using test.bitgo.com we do not have to give any values for the “IP Addresses Allowed” field, though when you make a production account you will need to whitelist the addresses your access token is allowed to send requests from. Add the following line to your ./bashrc file, or whichever shell initialization file your system uses:


Authentication Guide image 4


Open a new window of your shell and run the following command to verify you’ve set your access token correctly:


Authentication Guide image 5


If you exported your token value correctly, you should see it printed out to the terminal screen.

Now that you have your access token, you can programmatically authenticate yourself with BitGo’s servers using the BitGo SDK with the following two lines of code:

var BitGoJS = require('bitgo'); var bitgo = new BitGoJS.BitGo({ env: 'test', accessToken: process.env.ACCESS_TOKEN });


Authentication Guide image 6


Congratulations! You now have the full BitGo SDK’s functionality at your fingertips. If you'd like to unlock your access token for a prolonged period of time, you can use the Unlock API to have your session unlocked indefinitely.

Prev
February 24th, 2019
BitGo Supports Ethereum Constantinople Hard Fork
Next
August 16th, 2016
Believing in Bitcoin
Be One With the Code

Get started on the same great wallet used by over 40 Bitcoin Exchanges around the world & Integrate multiple digital currencies into your application with a single unified API.

Learn More
Contact Us