Skip to content

Commit ec8b6e4

Browse files
Update trustpath-fraud-protection.mdx
changed css to js in code snippets
1 parent d57a847 commit ec8b6e4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/content/docs/integrate/third-party-tools/trustpath-fraud-protection.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ For a workflow to function in Kinde, the workflow files need to be structured an
3535

3636
The workflow starts with a simple async function triggered after user authentication:
3737

38-
```css
38+
```js
3939
export default async function FraudDetectionWorkflow(event:
4040
onPostAuthenticationEvent) {
4141
}
@@ -60,7 +60,7 @@ To make an informed decision, TrustPath. needs more than a user ID—it also nee
6060

6161
Once these are set up, you can retrieve the additional data you need, using the `createKindeAPI` helper from [@kinde/infrastructure](https://github.com/kinde-oss/infrastructure), which allows us to call the Kinde Management API:
6262

63-
```css
63+
```js
6464
const kindeAPI = await createKindeAPI(event);
6565
const user = await getUserData(kindeAPI, event.context.user.id);
6666
async function getUserData(kindeAPI: any, userId: string) {
@@ -80,7 +80,7 @@ return user;
8080

8181
(Recommended) Store the API key securely as an [environment variable](/workflows/configuration/environment-variables-and-secrets/) in **Kinde**, just like the other variables mentioned above.
8282

83-
```css
83+
```js
8484
const trustPathAPIKey = getEnvironmentVariable("TRUSTPATH_API_KEY")?.value;
8585
```
8686
@@ -90,7 +90,7 @@ This ensures you’re not hardcoding sensitive credentials, and it keeps your ap
9090
9191
TrustPath evaluates risk differently based on the event type. For example, account creation versus account sign in.
9292
93-
```css
93+
```js
9494
const isNewUser = event.context.auth.isNewUserRecordCreated;
9595
const eventType = isNewUser ? "account_register" : "account_login";
9696
```
@@ -151,7 +151,7 @@ TrustPath supports many advanced configurations like this. You can contact their
151151
152152
Now that we have the user info and event type, we can build the payload to send to TrustPath when the workflow is triggered.
153153
154-
```css
154+
```js
155155
const requestBody = {
156156
ip: event.request.ip.split(",")[0].trim(), // Handles cases where multiple IPs are forwarded
157157
email: user.preferred_email,
@@ -171,7 +171,7 @@ This information passed in the request body allows TrustPath to cross-reference
171171
172172
Once the connection is set up between APIs, data is ready to be sent to TrustPath via a standard HTTP POST request. Here’s an example:
173173
174-
```css
174+
```js
175175
const response = await kinde.fetch(
176176
"https://api.trustpath.io/v1/risk/evaluate",
177177
{
@@ -198,7 +198,7 @@ When the API call to TrustPath comes back, the response will include a state fie
198198
199199
Here's how to enforce a block for declined requests:
200200
201-
```css
201+
```js
202202
const state = response.json.data.score.state;
203203

204204
if (state === "decline") {

0 commit comments

Comments
 (0)