New
Introducing Compute Orchestration
June 23, 2017

Introducing API Keys - A Safer Way To Authenticate Your Applications

Table of Contents:

As our customers build more sophisticated applications using Clarifai API, their requirements and needs are evolving. To provide greater flexibility and control to our customers, we are introducing API Keys, an authentication method that gives more power to developers to build applications for all of their needs.

We are introducing API Keys, an authentication method that gives more power to developers to build applications for all of their needs. Read on to learn more about Clarifai API  conventions keys and why they’re better for you, or skip directly to the usage instructions at the bottom of this post!


Authentication through API Keys will now contain scopes, which allows the key to only make selected API calls for an app. For example, a developer could generate an API Key that has permission to only make a ‘Predict’ or a ‘Search’ API call. This key could be considered as a ‘read-only’ key, as you wouldn’t be able to make any changes to the application using this key. Alternatively, if a developer is looking to create and train a custom model, then they would add “Models:Add” and “Models:Patch” scopes to their key.

 

There are many benefits to using A Copy And Paste Guide To Your First API Project With Clarifai API Keys, but they prove to be especially beneficial when developing an application that authorizes on the client side (e.g. the browser), or a mobile application. In each of those situations, there is a risk of an end user reverse engineering the code to retrieve the key that is being used. When building those applications, developers should protect their app by using a ‘read-only’ key in the production environment, reducing vulnerability of their 4 APIs You Need To Know To Build The Next Great App.

 

In the past, we have used OAuth2 client credentials (Client ID, Client Secret, Access Token) to authenticate access to our API. While this authentication method is also secure, it didn’t provide the flexibility of finer level scopes to be developed, nor did it allow our customers to delete a token, in case it was compromised. API Keys will empower our customers to do more Using Clarifai's Workflow API To Predict With Multiple Visual Models At Once.

 

We realize that this is a significant change in how developers interact with Importing Regions With The Clarifai API. However, we believe that this change is worth making, as it provides more power, security, and control for our customers, which in turn makes applications more secure, and makes the Clarifai platform friendlier to use.


With this change, existing developers that already have applications using Access Tokens for authentication will not experience a breaking change. We will allow both auth methods (Access Tokens and API Keys) until late 2017 to give everyone enough time to transition over to the new authentication method. Following that, we will deprecate Access Tokens, and developers will only be able to authenticate using API Keys.

Start using API Keys

  1. Log in to https://developer.clarifai.com, and click on “API Keys” on the left navigation bar
image1

 

  1. Each of your existing application will have an auto generated key, with ‘All’ scopes.
  2. Click on “Create New API Key” to create a key with finer scopes.
  3. Select your application, and the scopes you want to apply to the API Key. Enter a description that will help you identify your key.
image2

 

  1. Update your API Client, so it uses the new API Key method for authentication.
  2. Initialize your API Client with the API Key that was generated.

You can continue building your apps using the new and safer authentication method!
Further details for API Keys can be found in the Clarifai Documentation. Please contact Support if you have any additional questions.