# 403 Forbidden Error when using JavaScript code in Synthetic Monitor

**URL:** <https://community.dynatrace.com/t/403-forbidden-error-when-using-javascript-code-in-synthetic-monitor/49020>\
**Category:** Synthetic Monitoring\
**Tags:** javascript, synthetic-monitoring\
**Created:** [November 21, 2024, 8:00pm UTC](https://community.dynatrace.com/t/403-forbidden-error-when-using-javascript-code-in-synthetic-monitor/49020 "2024-11-21T20:00:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vuthayak](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@vuthayak](https://community.dynatrace.com/u/vuthayak)\
**Post date:** [November 21, 2024, 8:00pm UTC](https://community.dynatrace.com/t/403-forbidden-error-when-using-javascript-code-in-synthetic-monitor/49020/1 "2024-11-21T20:00:15Z")

</div>

Hello, as the title suggests, I am running into a “403 - FORBIDDEN” error when executing my synthetic monitor on a JavaScript event. I am using JavaScript to simulate a click on a popup window, as the normal Dynatrace click event does not seem to work, no matter what CSS selectors I provide. I would like to mention that up until a few days ago, the synthetic monitor was working without issues. Additionally, when accessing the site normally, I am able to use the same commands in the Developer Tools console to perform the action with no issues. Does anyone have a solution to this? Thanks.

```javascript
let btn = document.querySelector("#popup-element")
btn.click()

```

 ![vuthayak_0-1732219136224.png](https://global.discourse-cdn.com/dynatrace/original/3X/6/7/6705b0e28d27241db1dbf0de7961ceb54edefd44.png)

 ![vuthayak_1-1732219156586.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/d/fdfafd9c1520d534363fb99323e842e8a64b0bb8.png)

---

<div class="post-metadata">

**Author:** ![hannahmac](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/hannahmac/32/41823_2.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [November 22, 2024, 8:44am UTC](https://community.dynatrace.com/t/403-forbidden-error-when-using-javascript-code-in-synthetic-monitor/49020/2 "2024-11-22T08:44:27Z")

</div>

This would be better investigated in a ticket.

---

<div class="post-metadata">

**Author:** ![Peter\_Youssef](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/peter_youssef/32/14668_2.png) [@Peter\_Youssef](https://community.dynatrace.com/u/Peter_Youssef)\
**Post date:** [November 22, 2024, 2:55pm UTC](https://community.dynatrace.com/t/403-forbidden-error-when-using-javascript-code-in-synthetic-monitor/49020/3 "2024-11-22T14:55:20Z")

</div>

Hello&nbsp;[@vuthayak](https://community.dynatrace.com/user/81972)

You can solve it through:

- Validate the user privileges against the target URL “App”, at least active read “viewer” permissions.
- Check if the user credentials in credential vaults have been changed from Dynatrace or from the App side.
- Regarding the JavaScript, feel free to review:&nbsp;[https://community.dynatrace.com/t5/Start-with-Dynatrace/Synthetic-Monitoring-Configuring-RUM-Custom-JavaScript-Settings/td-p/260184](https://community.dynatrace.com/topic/260184)
- User Access Permissions:&nbsp;[https://community.dynatrace.com/t5/Start-with-Dynatrace/Synthetic-Monitoring-Global-Login-Authentication/td-p/259988](https://community.dynatrace.com/topic/259988)
- Under the configured synthetic Settings \> advanced \> Ignore specific status code \> specify 403 as long as your configurations are accurate.
- You also have an option to enable “bypass content security policy”

hoping it helps.

BR,

Peter
