Skip to main content
This section explains how to authenticate your API requests to the WaaS service in Cobo Portal Apps using Cobo OAuth.

Cobo OAuth vs Cobo Auth

Cobo Auth and Cobo OAuth are two authentication mechanisms. Cobo Auth identifies clients using an API key, while Cobo OAuth identifies clients using an app key and controls access to resources in other organizations through an Org Access Token, along with its permissions and scopes.
  • If you are developing Cobo Portal Apps for installation and use across different organizations, use Cobo OAuth to authenticate your API requests.
  • If you are developing other types of apps to access data and resources within your own organization, use Cobo Auth instead. For more details about Cobo Auth, refer to Authentication with Cobo Auth.

With the WaaS SDK

If you are using the WaaS SDK, you only need to provide the private key of the app key and Org Access Token in the API request as follows:

Without the WaaS SDK

If you don’t use the WaaS SDK, you need to provide all the required authentication information in the request header as follows:

Generate an app key

An app key is used to authenticate the Cobo Portal App when it makes an API request to the WaaS service. This section introduces three ways to generate an app key. You can also generate app keys using other tools that use the Ed25519 algorithm.
  • The public key will be used in the manifest file. For more information, refer to Configure the manifest file.
  • The private key will be used to authenticate API requests to the WaaS service.

Use Cobo CLI

  1. Install Cobo CLI if you haven’t. For more information, refer to Install Cobo CLI.
  2. In a terminal window, run the following command to generate a key pair.
You will see the public key displayed in the terminal window, and the private key is saved in the ~/.cobo/.env file by default.

Use OpenSSL

In a terminal window, run the following OpenSSL commands:
The private key is saved in the private.key.pem file, and the public key is saved in the public.key.pem file.

Use a Python library

  1. Install the ed25519 Python library. In a terminal window, run the following command:
  2. Generate a key pair. Import the function from the Python library to generate a key pair as follows:

Calculate an API signature

The following steps introduce how to calculate an API signature.
  1. First, concatenate a string based on your request as follows: str_to_sign = {METHOD}|{PATH}|{TIMESTAMP}|{PARAMS}|{BODY}
  2. Use the hashlib library to perform SHA-256 hashing twice on the string as follows:
  3. Use the private key of your app key to sign the string as follows:
Now you’ve calculated an API signature.