Skip to content

Commit

Permalink
updated public endpoints for attack detection
Browse files Browse the repository at this point in the history
  • Loading branch information
niftyvictor committed Sep 18, 2024
1 parent f5df768 commit 3acd823
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions v2/attackprotectionsuite/frontend-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ Below is an example of how to implement request ID generation on your frontend:

```tsx
const PUBLIC_API_KEY = "<public-api-key>"; // Your public API key that you received from the SuperTokens team
const SDK_URL = "https://supertokens.io/O6edpVVvewh85qFE/Z921AQOtdL6LpZvf";
const SDK_URL = "https://deviceid.supertokens.io/PqWNQ35Ydhm6WDUK/k9bwGCuvuA83Ad6s";
const PROXY_ENDPOINT_URL = "https://deviceid.supertokens.io/PqWNQ35Ydhm6WDUK/CnsdzKsyFKU8Q3h2"
const ENVIRONMENT_ID = "<environment-id>"; // Your environment ID that you received from the SuperTokens team

const supertokensAnomalyDetectionSdkPromise = import(SDK_URL + "?apiKey=" + PUBLIC_API_KEY).then((RequestId: any) => RequestId.load({
// Initialize the agent on page load.
const supertokensRequestIdPromise = import(SDK_URL + "?apiKey=" + PUBLIC_API_KEY).then((RequestId: any) => RequestId.load({
endpoint: [
SDK_URL,
PROXY_ENDPOINT_URL,
RequestId.defaultEndpoint
]
}));

async function getRequestId() {
const sdk = await supertokensAnomalyDetectionSdkPromise;
const sdk = await supertokensRequestIdPromise;
const result = await sdk.get({
tag: {
environmentId: ENVIRONMENT_ID,
Expand All @@ -55,19 +56,20 @@ Below is a full example of how to configure the SDK and pass the request ID to t
import EmailPassword from "supertokens-auth-react/recipe/emailpassword";

const PUBLIC_API_KEY = "<public-api-key>"; // Your public API key that you received from the SuperTokens team
const SDK_URL = "https://supertokens.io/JfNbWqtXUiGYuTqb/PYmK3PIPqdvHw6iz";
const SDK_URL = "https://deviceid.supertokens.io/PqWNQ35Ydhm6WDUK/k9bwGCuvuA83Ad6s";
const PROXY_ENDPOINT_URL = "https://deviceid.supertokens.io/PqWNQ35Ydhm6WDUK/CnsdzKsyFKU8Q3h2"
const ENVIRONMENT_ID = "<environment-id>"; // Your environment ID that you received from the SuperTokens team

// Initialize the agent on page load.
const supertokensRequestIdPromise = import(SDK_URL + "?apiKey=" + PUBLIC_API_KEY).then((RequestId: any) => RequestId.load({
endpoint: [
SDK_URL,
PROXY_ENDPOINT_URL,
RequestId.defaultEndpoint
]
}));

async function getRequestId() {
const requestId = await supertokensRequestIdPromise;
const result = await requestId.get({
const sdk = await supertokensRequestIdPromise;
const result = await sdk.get({
tag: {
environmentId: ENVIRONMENT_ID,
}
Expand Down

0 comments on commit 3acd823

Please sign in to comment.