Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@crowdin/crowdin-apps-functions

Package Overview
Dependencies
Maintainers
4
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crowdin/crowdin-apps-functions - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

5

out/models.d.ts

@@ -0,1 +1,5 @@

export interface AppToken {
accessToken: string;
expiresIn: number;
}
export interface Token {

@@ -21,2 +25,3 @@ accessToken: string;

appId: string;
appSecret: string;
clientId: string;

@@ -23,0 +28,0 @@ userId: number;

13

out/token.d.ts

@@ -1,6 +0,17 @@

import { JwtPayload, Token } from './models';
import { AppToken, JwtPayload, Token } from './models';
/**
*
* @param appId Crowdin app identifier
* @param appSecret Crowdin app secret received from install event
* @param clientId OAuth client id of the app
* @param clientSecret OAuth client secret of the app
* @param domain Crowdin organization domain
* @param userId The user who installed the application
* @returns token object which is needed to establish communication between app and Crowdin API
*/
export declare function fetchAppToken(appId: string, appSecret: string, clientId: string, clientSecret: string, domain: string, userId: number): Promise<AppToken>;
/**
*
* @param clientId OAuth client id of the app
* @param clientSecret OAuth client secret of the app
* @param code code used for authorization of your Crowdin app (returned in install event payload)

@@ -7,0 +18,0 @@ * @returns token object which is needed to establish communication between app and Crowdin API

@@ -12,3 +12,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.validateJwtToken = exports.getProjectId = exports.constructCrowdinIdFromJwtPayload = exports.refreshOAuthToken = exports.generateOAuthToken = void 0;
exports.validateJwtToken = exports.getProjectId = exports.constructCrowdinIdFromJwtPayload = exports.refreshOAuthToken = exports.generateOAuthToken = exports.fetchAppToken = void 0;
const axios_1 = require("axios");

@@ -19,4 +19,32 @@ const jwt = require("jsonwebtoken");

*
* @param appId Crowdin app identifier
* @param appSecret Crowdin app secret received from install event
* @param clientId OAuth client id of the app
* @param clientSecret OAuth client secret of the app
* @param domain Crowdin organization domain
* @param userId The user who installed the application
* @returns token object which is needed to establish communication between app and Crowdin API
*/
function fetchAppToken(appId, appSecret, clientId, clientSecret, domain, userId) {
return __awaiter(this, void 0, void 0, function* () {
const token = yield axios_1.default.post(crowdinAuthUrl, {
grant_type: 'crowdin_app',
client_id: clientId,
client_secret: clientSecret,
app_id: appId,
app_secret: appSecret,
domain: domain,
userId: userId,
});
return {
accessToken: token.data.access_token,
expiresIn: +token.data.expires_in,
};
});
}
exports.fetchAppToken = fetchAppToken;
/**
*
* @param clientId OAuth client id of the app
* @param clientSecret OAuth client secret of the app
* @param code code used for authorization of your Crowdin app (returned in install event payload)

@@ -23,0 +51,0 @@ * @returns token object which is needed to establish communication between app and Crowdin API

2

package.json
{
"name": "@crowdin/crowdin-apps-functions",
"version": "0.1.2",
"version": "0.1.3",
"description": "Utility library to easily and quickly develop Crowdin App",

@@ -5,0 +5,0 @@ "main": "out/index.js",

@@ -84,2 +84,3 @@ [<p align='center'><img src='https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png' data-canonical-src='https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png' width='200' height='200' align='center'/></p>](https://crowdin.com)

|------------------------------------|-----------------------------------------------------------------|
| `fetchAppToken` | fetch API token for communication with Crowdin API |
| `generateOAuthToken` | generates OAuth token for communication with Crowdin API |

@@ -86,0 +87,0 @@ | `refreshOAuthToken` | refresh OAuth token in case if it was expired |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc