Security for Crowdin Apps
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
In Crowdin übersetzenWhen you build a self-hosted app that works with data from Crowdin, it authenticates with crowdin_app and receives a signed JWT token with every request Crowdin sends it. Verifying that token is how the app tells a real request from anything else.
Both SDKs handle this for you: the Crowdin Apps SDK validates the token and extracts the context, and a serverless app never receives a token at all. What follows is for apps that verify requests themselves, for example one written in another language.
Crowdin opens a module page with the token and its context in the query string:
https://example.com/app-module?jwtToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJCcjRhMmhwUW……MX0.yt-lbv3Z8JyIGX4jG405mjZvX8lwc1q0EfWdTtm9GCc&origin=https://{domain}.crowdin.com&clientId=your-client-idQuery parameters:
jwtToken | Type: Description: JWT token used for authorization. |
origin | Type: Description: Host used for opening a module page. |
clientId | Type: Description: The ID of the OAuth Client used for authorization. |
The token is signed with the OAuth Client Secret, which only Crowdin and your app know, so a valid signature is proof of where the request came from. Verify the signature and the expiry of every token your app receives, for example in a middleware that runs before the rest of your code. Any of the existing libraries does it for you.
{ "aud": "Br4a2hpQiNW96anuuO4a", "sub": "1", "domain": null, "context": {}, "iat": 1600000000, "exp": 1600000900}Properties:
aud | Type: Description: ID of the OAuth Client that issued the token. |
sub | Type: Description: Identifier of the user that is making a request to the Crowdin app. |
domain | Type: Description: The organization the app is accessed from. Always present, and always |
context | Type: Description: The environment where the module is opened, such as the project, the locale, and the user’s timezone. |
iat | Type: Description: Identifies the issue time of the token. |
exp | Type: Description: Identifies the expiration time of the token. |