15 Jul 2026
10:02 AM
- last edited on
16 Jul 2026
07:28 AM
by
MaciejNeumann
Hi,
We're trying to build asynthetic browser test against a site that requires OTP.
As there is no direct API to get the OTP data from the provider we need to bypass it so we've created a "back door" workflow to extract it and generate a business event that will store the result. we now in the stage that we need to query it using DQL from the script but facing CORS error as the Dynatrace domain is different than the tested site.
we already know the great article from @HannahM however the current issue is how to avoid the CORS error when accessing the platform without signing in to the platform itself (as accessing the domain itself directly goes to the login page).
Any ideas?
Gil.
Solved! Go to Solution.
16 Jul 2026 12:57 PM
Does it matter that you only go to the login page? You could ignore the 401 error, if that's causing a failure, or is it that the login page is another domain so doesn't help?
22 Jul 2026 11:53 AM
Hi @HannahM
It seemed like it was not enough but found out there was another issue. we're testing it right now. will update.
Gil.
23 Jul 2026 10:11 AM
Hi @HannahM ,
So I have the following browser test js node:
api.startAsyncSyntheticEvent();
const url = 'https://TENANTURL.apps.dynatrace.com/platform/storage/query/v1/query:execute';
const payload = {
"query": "fetch logs, from:now()-10m",
"requestTimeoutMilliseconds": 10000
};
fetch(url, {
method: 'POST',
headers: {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer TOKEN'
},
body: JSON.stringify(payload)
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return response.json();
})
.then(data => {
if (data.state && data.state !== 'SUCCEEDED') {
api.fail("Query not complete inline, state: " + data.state);
return;
}
api.info("GIL: records = " + (data.result ? data.result.records.length : 0));
api.finish();
})
.catch(error => {
api.fail("GIL: fetch failed: " + error.message);
});It runs after I navigate to my tenant url and being redirected to the sso page.
The fetch itself fails at the end and the message is plain "fetch failed". we've even changed the original website to another one. any thoughts? (I think this discussion is important to many use cases hence this is not directly also managed in a ticket - let me know if only a summary should be done here)
23 Jul 2026 07:30 PM
if I understood correctly, you have a Workflow that retrieve the OTP and stores as business events. And now, you are using the synthetic step to query this value to use it as authentication... right?
Why not store the OTP in a credential vault instead, that can be used natively by synthetics?
26 Jul 2026 06:55 AM
I should have thought of it myself!! thanks @dannemca
28 Jul 2026 02:17 PM
That's what community is for!!!
Featured Posts