Authentication

Login to API using Figma OAuth

Token creation

User Authentication and creation is done through Figma's OAuth2. When you request this endpoint you will first receive a URL to allow the user to give access to Cannoli with a pre-configured redirect uri. You can override this through the redirect_uri GET parameter:

/api/v1/login/?redirect_uri=<YOUR_REDIRECT_URI>

In order to complete the authentication process Figma returns a code which is used by the backend to complete the handshake process. If you want to login through a separate frontend you need to override the redirect_uri, receive the code and send it back to this endpoint along with the redirect_uri you configured:

/api/v1/login/?redirect_uri=<YOUR_REDIRECT_URI>&code=<CODE_FROM_FIGMA> 

Once you complete the authentication process you'll receive a jwt token to authenticate with the API. The access_token has a lifetime of 30 minutes and the refresh_token has a lifetime of 7 days.

Authenticating with the API once you have your token

Once you complete the authentication procces you must send your access_token as a Bearer header:

curl -H "Content-Type: application/json" -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
https://api-dev.cannoli.app/api/v1/figma/files/ 
get/login/

Request

  • Base URL
    http://api.cannoli.app/api/v1
  • Auth
    none declared

Query parameters

codestring

Figma's response code which is used to verify the user's authorization and create the API credentials

redirect_uristring

Allows you to override redirect_uri for multi-environment support

Response

User login response

access_tokenstring required
refresh_tokenstring required
access_token_expires_innumber required
refresh_token_expires_innumber required

Changes

No recorded changes to this operation across all 1 revision of this API.