<?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: can we retrieve sas token in sas studio? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/can-we-retrieve-sas-token-in-sas-studio/m-p/896883#M354407</link>
    <description>&lt;P&gt;If you don't want users to put token every time they want to access sas product like me, in my case I use this code :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename resp "your json file";
%let url = %nrstr("your publish sas product");
/*$one_json is your input*/
%let one_json = '{"inputs":[{"name": " ", "value": " "},{"name": " ", "value":" "}]}';
proc http
	url = &amp;amp;url.
	in = &amp;amp;one_json.
	out = resp
	method = post
	oauth_bearer = sas_services
	ct = "application/vnd.sas.microanalytic.module.step.input+json";
run;
		
/* read json and create it as a library named logdata */
libname logdata json "your json file";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Or you can see my other blog: (&lt;A href="https://communities.sas.com/t5/SAS-Programming/how-to-get-sas-access-token-in-proc-http/m-p/888299#M350977" target="_self"&gt;https://communities.sas.com/t5/SAS-Programming/how-to-get-sas-access-token-in-proc-http/m-p/888299#M350977&lt;/A&gt;&amp;nbsp;). There is solution from DavidHD that might help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2023 09:34:23 GMT</pubDate>
    <dc:creator>Mayt</dc:creator>
    <dc:date>2023-10-03T09:34:23Z</dc:date>
    <item>
      <title>can we retrieve sas token in sas studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-we-retrieve-sas-token-in-sas-studio/m-p/887627#M350674</link>
      <description>&lt;P&gt;Hi guys! I've tried to use proc http to call sas decision. It works well, but right now I need to specify access token myself. That means whenever the token gets changed, I need to edit my code. So the question is how can I retrieve the token from sas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I generated sas token from the following link :&amp;nbsp;&lt;A href="https://blogs.sas.com/content/sgf/2023/02/07/authentication-to-sas-viya/" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/sgf/2023/02/07/authentication-to-sas-viya/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code right now:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc http &lt;BR /&gt;   METHOD="POST" 
   url="&lt;EM&gt;mysasdecisionurl&lt;/EM&gt;"    
   in='{"inputs":[]}'
   ct = "applicationvnd.sas.microanalytic.module.step.input+json"
   out=resp
   oauth_bearer = sas_services;
   headers 'Authorization'= "&lt;EM&gt;My token&lt;/EM&gt;";  
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I found some solution from this link :&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-use-PROC-HTTP-with-OAUTH-to-get-an-access-token-from-a/td-p/778490" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/How-to-use-PROC-HTTP-with-OAUTH-to-get-an-access-token-from-a/td-p/778490&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it seems every time the code is executed, a new token will be generated. I just want to retrieve an old token, not to generate a new token.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 08:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-we-retrieve-sas-token-in-sas-studio/m-p/887627#M350674</guid>
      <dc:creator>Mayt</dc:creator>
      <dc:date>2023-08-03T08:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: can we retrieve sas token in sas studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-we-retrieve-sas-token-in-sas-studio/m-p/896770#M354353</link>
      <description>&lt;P&gt;I'm also having the same problem. I would like to know how to use the authentication token that the user made to access SASStudio itself.&lt;/P&gt;
&lt;P&gt;In other words, being able to authenticate to the Viya APIs with the user's own credentials logged into SAS Studio.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 19:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-we-retrieve-sas-token-in-sas-studio/m-p/896770#M354353</guid>
      <dc:creator>dcmacedo</dc:creator>
      <dc:date>2023-10-02T19:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: can we retrieve sas token in sas studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/can-we-retrieve-sas-token-in-sas-studio/m-p/896883#M354407</link>
      <description>&lt;P&gt;If you don't want users to put token every time they want to access sas product like me, in my case I use this code :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename resp "your json file";
%let url = %nrstr("your publish sas product");
/*$one_json is your input*/
%let one_json = '{"inputs":[{"name": " ", "value": " "},{"name": " ", "value":" "}]}';
proc http
	url = &amp;amp;url.
	in = &amp;amp;one_json.
	out = resp
	method = post
	oauth_bearer = sas_services
	ct = "application/vnd.sas.microanalytic.module.step.input+json";
run;
		
/* read json and create it as a library named logdata */
libname logdata json "your json file";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Or you can see my other blog: (&lt;A href="https://communities.sas.com/t5/SAS-Programming/how-to-get-sas-access-token-in-proc-http/m-p/888299#M350977" target="_self"&gt;https://communities.sas.com/t5/SAS-Programming/how-to-get-sas-access-token-in-proc-http/m-p/888299#M350977&lt;/A&gt;&amp;nbsp;). There is solution from DavidHD that might help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 09:34:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/can-we-retrieve-sas-token-in-sas-studio/m-p/896883#M354407</guid>
      <dc:creator>Mayt</dc:creator>
      <dc:date>2023-10-03T09:34:23Z</dc:date>
    </item>
  </channel>
</rss>

