<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Token visible in Javascript in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/248001#M1590</link>
    <description>&lt;P&gt;Yes, that's all correct. Don't return the token. Support for using credentials/secrets in a secure way is on the roadmap, as far as I know. For the time being,&lt;/P&gt;&lt;P&gt;For the time being, you can use fetch in the Run JavaScript action like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  const token = await credentialVaultClient.getCredentialsDetails({
    id: "CREDENTIALS_VAULT-ABCD1234",
  }).then((credentials)=&amp;gt; credentials.token);

  const url = "https://....";

  const response = await fetch(url, {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${token}`
    }
  ).then(response =&amp;gt; response.json());&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 11 Jun 2024 13:11:15 GMT</pubDate>
    <dc:creator>christian_kreuz</dc:creator>
    <dc:date>2024-06-11T13:11:15Z</dc:date>
    <item>
      <title>Token visible in Javascript</title>
      <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/247988#M1585</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I notice you can see the value of a token when used in Javascript, I assume that this is inherent to the used implementation? Or will there be an improvement?&lt;/P&gt;&lt;P&gt;KR Henk&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="henk_stobbe_0-1718106034452.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20462iDBA77A1CDDA213CE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="henk_stobbe_0-1718106034452.png" alt="henk_stobbe_0-1718106034452.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 11:44:41 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/247988#M1585</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2024-06-11T11:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Token visible in Javascript</title>
      <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/247993#M1586</link>
      <description>&lt;P&gt;Hi! In the screenshot, you're seeing the Result tab of a "run_javascript" task. Most likely, the token is returned as part of this task. You can investigate and change this by editing the Workflow, and looking at the "Run JavaScript" task in question, which probably looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// optional import of sdk modules
import { execution } from '@dynatrace-sdk/automation-utils';

export default async function ({ execution_id }) {
  // your code goes here
  const token = "1234";
  const scope = "SCOPE";

  // do something
  
  return { token: token, scope: scope };
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;edit: now if you're asking whether you can mask this token, that's a no for now. What you could however do instead is store the token using &lt;A href="https://developer.dynatrace.com/develop/data/app-settings/#use-secrets" target="_self"&gt;secrets in App-Settings&lt;/A&gt; or &lt;A href="https://developer.dynatrace.com/reference/sdks/client-classic-environment-v2/#credentialvaultclient" target="_self"&gt;Dynatrace Credential Vault&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 12:50:34 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/247993#M1586</guid>
      <dc:creator>christian_kreuz</dc:creator>
      <dc:date>2024-06-11T12:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Token visible in Javascript</title>
      <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/247996#M1587</link>
      <description>&lt;P&gt;Hi Christian,&lt;/P&gt;&lt;P&gt;Sorry, it is returned by below code in the task:&lt;/P&gt;&lt;P&gt;tokenCredentials = await credentialVaultClient.getCredentialsDetails({&lt;BR /&gt;id: 'CREDENTIALS_VAULT-04B79924E62A26F3',&lt;/P&gt;&lt;P&gt;So I was thinking it is the real token value&lt;/P&gt;&lt;P&gt;KR Henk&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 12:51:12 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/247996#M1587</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2024-06-11T12:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Token visible in Javascript</title>
      <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/247998#M1588</link>
      <description>&lt;P&gt;Now I see &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; The Run JavaScript task is doing exactly what you tell it to do, which, in this case, is returning the &lt;STRONG&gt;full response&lt;/STRONG&gt; of getCredentialsDetails from credentialVaultClient.&lt;/P&gt;&lt;P&gt;I suppose you want to use the token returned in a follow-up task?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 12:55:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/247998#M1588</guid>
      <dc:creator>christian_kreuz</dc:creator>
      <dc:date>2024-06-11T12:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Token visible in Javascript</title>
      <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/248000#M1589</link>
      <description>&lt;P&gt;Absolutely,&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in simple terms, next step would be a POST request using this credential.&lt;/P&gt;&lt;P&gt;My main concern was that I can see the token used in the script, so this would be a security risk as anybody who can see the workflow can possibly see and copy the token?&lt;/P&gt;&lt;P&gt;See my token definition:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="henk_stobbe_0-1718111154228.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20463iB82F817FFCDDBAA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="henk_stobbe_0-1718111154228.png" alt="henk_stobbe_0-1718111154228.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;KR Henk&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 13:06:30 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/248000#M1589</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2024-06-11T13:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Token visible in Javascript</title>
      <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/248001#M1590</link>
      <description>&lt;P&gt;Yes, that's all correct. Don't return the token. Support for using credentials/secrets in a secure way is on the roadmap, as far as I know. For the time being,&lt;/P&gt;&lt;P&gt;For the time being, you can use fetch in the Run JavaScript action like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  const token = await credentialVaultClient.getCredentialsDetails({
    id: "CREDENTIALS_VAULT-ABCD1234",
  }).then((credentials)=&amp;gt; credentials.token);

  const url = "https://....";

  const response = await fetch(url, {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${token}`
    }
  ).then(response =&amp;gt; response.json());&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 11 Jun 2024 13:11:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/248001#M1590</guid>
      <dc:creator>christian_kreuz</dc:creator>
      <dc:date>2024-06-11T13:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Token visible in Javascript</title>
      <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/248002#M1591</link>
      <description>&lt;P&gt;Cool thx Christain!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 13:16:16 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/248002#M1591</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2024-06-11T13:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Token visible in Javascript</title>
      <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/277691#M2164</link>
      <description>&lt;P&gt;Hi, is this solution also valid for Managed?&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 13:00:56 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/277691#M2164</guid>
      <dc:creator>kuncarlos</dc:creator>
      <dc:date>2025-05-21T13:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Token visible in Javascript</title>
      <link>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/277694#M2165</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;No, it's only for SaaS, with DPS.&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 13:33:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Token-visible-in-Javascript/m-p/277694#M2165</guid>
      <dc:creator>christian_kreuz</dc:creator>
      <dc:date>2025-05-21T13:33:15Z</dc:date>
    </item>
  </channel>
</rss>

