Spacebridge Challenge

I want to enable spacebridge on my pi. Using the following instructions:

GENERATE SSH KEY AND UPLOAD TO HOLOGRAM API

You only need to complete this section the first time you’re setting up the tunnel on this computer. If you already have an SSH keypair that you’d like to use, skip to step 2.

  1. Use ssh-keygen to generate a SSH keypair:
    ssh-keygen -f spacebridge.key -b 4096

You’ll see a prompt asking if you want to put a password on the key. We recommend this for enhanced security.
Upload your public key to the Hologram API.

  1. In the code below, replace with your Hologram API key (Found on the Dashboard by clicking on the Account menu at the bottom-left and selecting API from the side menu). If you are using a key that you already generated, replace the filename in the export command.
    The filename ends in .pub, not .key. If you use the .key file this will upload your private key which you don’t want to do.
    PUBKEY=$(cat spacebridge.key.pub); curl -X POST -H “Content-Type: application/json” -d “{"public_key":"$PUBKEY"}” “https://dashboard.hologram.io/api/1/tunnelkeys?apikey=
    You should get a successful response back.

So I generated the key on the pi - no problem.

I went to my dashboard and went to account → API and the key had not been generated, so I clicked on the Generate button and now I have an API key

I copied this key and placed it in the command replacing the text APIKEY with the new api generated and tried the command. For example, assume my new API key from the dashboard is 123456 - my pi command looks like:

PUBKEY=$(cat spacebridge.key.pub); curl -X POST -H “Content-Type: application/json” -d “{"public_key":"$PUBKEY"}” “https://dashboard.hologram.io/api/1/tunnelkeys?apikey=<123456>”

However, I get the following response:

{“success”:false,“error”:“Invalid API Key”}

What have I done wrong?

Just to confirm, did you leave off the brackets in the real url with your apikey? Would be ?apikey=123456

It may have to do with whitespace or line endings. When I put the contents of the pub key directly into curl request, it worked:

curl -X POST -H "Content-Type: application/json" -d '{"public_key":"ssh-rsa <long key string> username@example"}' "https://dashboard.hologram.io/api/1/tunnelkeys?apikey=<key>"