App Functions
The Apps SDK exposes utility functions for OAuth and app tokens, JWT validation, and common Crowdin API tasks (files, folders, translations, webhooks, and subscriptions).
Example usage
Section titled “Example usage”import { generateOAuthToken } from '@crowdin/app-project-module/functions/token';
generateOAuthToken({ clientId: 'app_client_id', clientSecret: 'app_client_secret', code: 'code_from_install_event',});Functions summary
Section titled “Functions summary”These helpers are meant to speed up app development and Crowdin API integration. For parameters, return types, and edge cases, use the JSDoc on each export.
Token functions
Section titled “Token functions”@crowdin/app-project-module/functions/token
| Method name | Description |
|---|---|
fetchAppToken | Fetches an API token for communication with the Crowdin API |
fetchAgentToken | Fetches an Agent API token for communication with the Crowdin API |
fetchAppWithCodeToken | Fetches an app API token using an authorization code for the Crowdin API |
generateOAuthToken | Generates an OAuth token for communication with the Crowdin API |
refreshOAuthToken | Refreshes an OAuth token when it has expired |
constructCrowdinIdFromJwtPayload | Builds a Crowdin user-and-project id from JWT context |
getProjectId | Extracts the project id from a Crowdin id |
parseCrowdinId | Parses organization (id or domain), project id, and user id from a Crowdin id |
validateJwtToken | Validates the JWT issued for your app |
Crowdin functions
Section titled “Crowdin functions”@crowdin/app-project-module/functions/crowdin
| Method name | Description |
|---|---|
updateOrCreateFile | Creates or updates a file in Crowdin |
getFolder | Gets a folder and the files under it |
getOrCreateFolder | Returns a folder and its files, or creates the folder if it does not exist |
uploadTranslations | Uploads a file to storage and sends an upload-translations request |
updateSourceFiles | Updates source files under a given directory |
handleTranslations | Runs a side effect for each translated file |
createOrUpdateWebhook | Creates or updates a webhook |
getSubscription | Returns subscription information for the app |
See also
Section titled “See also”- Context — JWT payload and project fields used alongside token helpers
- Job — long-running project integration tasks that often call Crowdin helpers
- Project integration — sample that uses
@crowdin/app-project-module/functions/crowdin - Security best practices — securing custom routes that rely on Crowdin JWTs and API access