Detect a session id cookie with TypeScript in Flows
This TypeScript example checks an API response for a sails.sid cookie. If a sails.sid cookie is present in the response, it could indicate that a session ID has been leaked. By using TypeScript to check for the sails.sid cookie in an If or Condition block, you can route the response to different blocks, depending on the result.
Example JSON
The example uses JSON data from a GET request to postman-echo.com like this:
Check a response for sails.sid
The following TypeScript checks an API response in a variable named response for a sails.sid cookie:
If the sails.sid cookie is present in the response, the TypeScript returns true. Otherwise, it returns false. You can use this example script in an If or Condition block to route the response data based on the result.
Example
To see this TypeScript in an example flow, check out TypeScript example 2: Check for session cookie.