Prerequisites

Setting up CodeMash API keys for accessing services

To make calls to the CodeMash servers and access your resources, you will need - a project ID and a secret key.

Project ID

Your CodeMash Project ID or Project ID is our primary identifier to differentiate your project from all other CodeMash projects. You will use this in all your SDK initialization codes and API calls. You should not treat the Project ID as private.

Secret Key

Do not share this key!

Treat your REST API Key as though it is a password - do not add it to your app code or public repositories (e.g., GitHub), and do not share it with anyone.

How to find Project ID and Secret Key

  1. Login to the CodeMash dashboard.

  2. Inside your CodeMash dashboard, select your project.

  3. Inside your project settings, find settings called Project ID and Secret key.

    • For Project ID, copy it.

    • For Secret Key, press Regenerate and then copy generated token. The token will not be accessible after you close it; you must regenerate it.

In project settings, you regenerate the Secret Key of your project root account that was created automatically during the initialization process. Never use it in a production environment because this Secret Key has all the permissions, and malicious users can delete your resources and data. For this purpose, create a separate membership user of type "Service" and add only necessary permissions.

Storing tokens

The following shows how to store tokens using different languages and frameworks.

To store your tokens in private, use environment variables. This way, you won't expose your secret key to public places.

You can store your tokens in the appsettings.json (name can be different) file in your base project folder. CodeMash SDK expects the following format:

{
  "CodeMash" : {
    "ApiKey" : "{YOUR_SECRET_KEY}",
    "ProjectId" : "{YOUR_PROJECT_ID}"
  }
}

Last updated