Quick script to generate Brightbox cloud API tokens for different environments
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Get Token

This is a simple Ruby script to generate API tokens from the Brightbox Cloud API using your credentials.

Details about the Brightbox Cloud are available here: http://brightbox.com/

The Brightbox API uses OAuth2 (Draft 10) token based authentication for all of it's requests. So if you find yourself making requests from curl getting valid tokens becomes a pain.

Whilst useful at a low level, you might find using the Brightbox CLI tools (https://github.com/brightbox/brightbox-cli) or the Fog library (https://github.com/fog/fog) more use.


The script uses your existing Fog credentials to access the Brightbox URL, client ID and secret and perform an API call to request a token.

Fog supports multiple sets of credentials, each can be setup separately.

  :brightbox_client_id:   cli-named
  :brightbox_secret:      zsp3mk48hwhklt
  :brightbox_auth_url:    "https://api.gb2.brightbox.com"
  :brightbox_api_url:     "https://api.gb2.brightbox.com"
  :brightbox_client_id:   cli-kklds
  :brightbox_secret:      3hht333qjfDsa17

(These are fake values before you think I wasn't paying attention!)


Given it's goal, it is pretty minimal.

Run the script without arguments and it will use your default credentials.

$ get_token

Run the script with the name of another set of credentials it uses them instead

$ get_token additional
$ curl https://api.gb1.brightbox.com/1.0/account -H "Authorization: OAuth `get_token`"
... Lots of JSON ...

Future development

This is a pretty simple tool that might be useful to someone else. No real additional work on this script.

A replacement tool is planned.

  • Delivered as a gem
  • Will also check Brightbox CLI credentials for possible matches