Access url parameter from sisense script
Summary: The discussion focused on accessing URL parameters from a Sisense script, but no specific content was shared by the participants.
Hi, we are embedding sisense report from our react app by iframe.
```
<iframe src={url} style={{ width: '100%', height: '100vh' }}></iframe>
```
Its working perfectly, but we need to send extra parameter that can be accessed by sisense script
```
<iframe src={`${url}?custom_auth_token=xyz`} style={{ width: '100%', height: '100vh' }}></iframe>
```
Then we need to access this token here
/*
Welcome to your Dashboard's Script.
To learn how you can access the Widget and Dashboard objects, see the online documentation at https://sisense.dev/guides/js/extensions
*/
const authToken = {way to access token}
riaj03
Posted 2 years ago · Edited 1 month ago·Last reply 2 years ago
3 comments
DRay
·2 years agoHello riaj03,
Did any of the solutions offered by work for you? If so, please click the 'Accept as Solution' button so that other users with the same questions can find the answer faster. If not, please let us know so that we can continue to help.
Thank you.
moti
·2 years agoThe simplest JavaScript method to extract query parameters from the URL is:
You can use this in the dashboard script, however keep in mind that if this is needed across multiple dashboards or all dashboards, it would be better to implement as an Add-on to make maintenance easier (one shared add-on is easier to modify than multiple copies of the same dashboard script)
IsaacBlanco
·2 years agoHey riaj03 , I'm not quite sure if is possible inside a dashboard script, I know that inside an add on is possible, but you can try this.
Put an message listener in both your React code and in your dashboard script. In this way you can communicate with postMessages between them, once you have your information you can send it out through the postMessage to the iframe.