<?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: Retrieving name of current user in JavaScript (Notebook, Dashboard) in Developer Q&amp;A Forum</title>
    <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/242289#M846</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/9516"&gt;@stefan_eggersto&lt;/a&gt;&amp;nbsp;!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm developing a custom APP, and when I call the API via App Function, I get Error: Authentication required. How can I implicitly authenticate?&lt;/P&gt;&lt;P&gt;Here's my &lt;SPAN&gt;snippet;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export default async function() {
  return fetch("https://{environmentid}.apps.dynatrace.com/platform/metadata/v1/user")
  .then((response) =&amp;gt; response.json())
  .then((data)=&amp;gt; {return data})
  .catch((error) =&amp;gt; console.log(error));
}&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 10 Apr 2024 08:38:10 GMT</pubDate>
    <dc:creator>MaximilianoML</dc:creator>
    <dc:date>2024-04-10T08:38:10Z</dc:date>
    <item>
      <title>Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226238#M580</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I am trying to get the username of the user that executes some JavaScript in either a notebook or dashboard. I assume that functionality exists in one of the SDKs but I couldnt find anything&lt;/P&gt;
&lt;P&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 12:31:56 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226238#M580</guid>
      <dc:creator>andreas_grabner</dc:creator>
      <dc:date>2023-10-23T12:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226344#M581</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/146"&gt;@andreas_grabner&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;There is currently no SDK available to get the user info, but you can directly call a platform API with the following snippet:&lt;/P&gt;
&lt;PRE&gt;export default async function() {&lt;BR /&gt;  const response = await fetch("/platform/metadata/v1/user");&lt;BR /&gt;  const json = await response.json();&lt;BR /&gt;  return json.userName;&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;An SDK should be available in the near future.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 10:55:54 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226344#M581</guid>
      <dc:creator>stefan_eggersto</dc:creator>
      <dc:date>2023-12-12T10:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226368#M582</link>
      <description>&lt;P&gt;Thanks!!&lt;/P&gt;
&lt;P&gt;FYI - the returned user object has three properties in case anyone is interested: userName, userId, emailAddress&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 08:22:22 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226368#M582</guid>
      <dc:creator>andreas_grabner</dc:creator>
      <dc:date>2023-10-24T08:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226414#M583</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/9516"&gt;@stefan_eggersto&lt;/a&gt;&amp;nbsp;I would guess it is but to make sure - would the same also apply to indetify the current user running an application?&lt;/P&gt;&lt;P&gt;and&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/146"&gt;@andreas_grabner&lt;/a&gt;&amp;nbsp;thanks for asking this just a few hours before I stumbled upon this issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 11:18:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226414#M583</guid>
      <dc:creator>gilgi</dc:creator>
      <dc:date>2023-10-24T11:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226419#M584</link>
      <description>&lt;P&gt;Yes, you can use the same call to identify the app user.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 11:21:40 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/226419#M584</guid>
      <dc:creator>stefan_eggersto</dc:creator>
      <dc:date>2023-10-24T11:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/242289#M846</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/9516"&gt;@stefan_eggersto&lt;/a&gt;&amp;nbsp;!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm developing a custom APP, and when I call the API via App Function, I get Error: Authentication required. How can I implicitly authenticate?&lt;/P&gt;&lt;P&gt;Here's my &lt;SPAN&gt;snippet;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export default async function() {
  return fetch("https://{environmentid}.apps.dynatrace.com/platform/metadata/v1/user")
  .then((response) =&amp;gt; response.json())
  .then((data)=&amp;gt; {return data})
  .catch((error) =&amp;gt; console.log(error));
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Apr 2024 08:38:10 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/242289#M846</guid>
      <dc:creator>MaximilianoML</dc:creator>
      <dc:date>2024-04-10T08:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/242577#M852</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/73851"&gt;@MaximilianoML&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is expected when you use an absolute URL. If you would use a relative URL, you should be fine&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;fetch("/platform/metadata/v1/user");&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Sini&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 08:44:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/242577#M852</guid>
      <dc:creator>sinisa_zubic</dc:creator>
      <dc:date>2024-04-15T08:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/252265#M1047</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/38283"&gt;@sinisa_zubic&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;This works fine as long as the application is running locally. I get a 401 once I deploy it to the platform.&lt;BR /&gt;&lt;STRONG&gt;Response&lt;/STRONG&gt;:&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;{\"error\":{\"code\":401,\"message\":\"Unsupported authorization scheme 'Api-Token'. Dynatrace platform APIs require the authorization scheme 'Bearer'.\",\"details\":{\"traceId\":\"3c2803d28b272248ba1b9916ab137948\"}}}"&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;my request:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;const url = "/platform/metadata/v1/user";&lt;/P&gt;&lt;P&gt;const res = await fetch(url, {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; headers: {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Authorization: `Api-Token ${tokenCredentials["token"]}`,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; },&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;Any SDK available for this?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 12:51:26 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/252265#M1047</guid>
      <dc:creator>muzztafa</dc:creator>
      <dc:date>2024-08-01T12:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/263251#M1176</link>
      <description>&lt;P&gt;Hi muzztafa,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the SDK was released in late August. See:&amp;nbsp;&lt;A href="https://developer.dynatrace.com/develop/sdks/app-environment/" target="_blank" rel="noopener noreferrer"&gt;https://developer.dynatrace.com/develop/sdks/app-environment/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also check this thread out:&amp;nbsp;&lt;A href="https://community.dynatrace.com/t5/Developer-Q-A-Forum/Dynatrace-App-Current-user-information/m-p/218433" target="_blank"&gt;https://community.dynatrace.com/t5/Developer-Q-A-Forum/Dynatrace-App-Current-user-information/m-p/218433&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 15:46:33 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/263251#M1176</guid>
      <dc:creator>haris</dc:creator>
      <dc:date>2024-11-21T15:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving name of current user in JavaScript (Notebook, Dashboard)</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/263582#M1189</link>
      <description>&lt;P&gt;Hey, I'm happy to announce that there is now an SDK package out for a while:&amp;nbsp;&lt;A href="https://developer.dynatrace.com/develop/sdks/app-environment/" target="_blank"&gt;https://developer.dynatrace.com/develop/sdks/app-environment/&lt;/A&gt;&lt;BR /&gt;So, you can get the currently logged-in user with:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import {getCurrentUserDetails} from "@dynatrace-sdk/app-environment";
export default async function () {
  return getCurrentUserDetails();
}&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 13:08:39 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Retrieving-name-of-current-user-in-JavaScript-Notebook-Dashboard/m-p/263582#M1189</guid>
      <dc:creator>s_wasserbauer</dc:creator>
      <dc:date>2024-11-25T13:08:39Z</dc:date>
    </item>
  </channel>
</rss>

