Dashboards & Visualizations

How to pass and consume a token from a URL?

rbardonetorian
Path Finder

Hello All,

I am having some trouble getting my head wrapped around the use of the required library to pull the passed token value from the URL string. I have seen this page: link text and I still dont get it.

I would like to call a page of my app with a token specified. ie: mylongserverurlstring?token=passedvalue

Then, what I am having an issue with is understanding the proper use of the splunkJS library to enable token extraction functionality.

I need something that clearly spells out how to use : splunkjs.mvc.Components.get('default').set('mytoken', value) library.

Currently my JS looks like:
...

<iframe src=$token|s$ id="myframe"></iframe>

<script type="text/javascript">
   require([
    "splunkjs/mvc",
    "splunkjs/mvc/utils",
    "splunkjs/mvc/tokenutils",
    "underscore",
    "jquery"
    ],
    function(
         mvc,
         utils,
         TokenUtils,
         _,
         $
         ){

    var pageloading = true;

   splunkjs.mvc.Components.getInstance("default").set(token);

    var iframe=document.getElementById('myframe');
     window.open(url, "myframe");
</script>

My goal is to pull the token from the initial URL string and plug it into the iframe src.

Thank you for the help!!

0 Karma
1 Solution

rbardonetorian
Path Finder

solving with URLloader from sideview....

View solution in original post

0 Karma

rbardonetorian
Path Finder

solving with URLloader from sideview....

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...