Using API Key for Extractions in SPA Widget

Learn how to extract keys using the live SPA widget.

Extracting API keys using the SPA widget

Let's see how we can use the SPA widget to extract API keys to use throughout the course. Please note that this will only work for a Live SPA widget that uses Docker.

  1. Select the "Extract" option for the API key you wish to extract from the "Select API Keys" window. In this case, we will select "api_key_4."

  2. Run the code. You will see an "Extract API Keys" button at the bottom of the widget.

  3. When you click on this button for the first time, you will see an error the following error:
    "No keys found in terminal to extract".

  4. You can type the following command to define your API key in the terminal:
    export api_key_4="Hello"

  5. Once we define our API key, we can click the "Extract API Keys" button again to see the value of that key. Some additional information is displayed below the button. You can edit and save it accordingly.

  6. Once you save this, the value for api_key_4 will be automatically updated throughout the course wherever it is used.

Step 1
Step 1
1 of 5

Demonstration of API key extraction

Run the code below and extract the API key, api_key_4, as demonstrated above.

This code is empty so that we can specifically demonstrate the API Key 
extraction process using the terminal in a Live SPA widget.

If done correctly, you will see that the code below will automatically update with the extracted API key.

#include <iostream>
using namespace std;
int main() {
// your code goes here
cout << "{{api_key_4}} World!";
return 0;
}