Hi,
I am developing a ASP.Net webforms application using .Net Framework 4.5.2 and C#. I have a web page where a list of SAS reports are displayed. I was provided a access token to access the SAS Viya. How can I pass the the token to the report. Below is the sample report. There might be several other reports like below. I want to avoid the SAS Logon page and open the report. Since I need to use interactive UI, I cannot use the SAS REST API.
https://sasviya.test.com/SASJobExecution/?_program=/Projects/MyOrg/ExpenseReport
Any suggestions are welcome.
Hi @smallajyosula ,
You pass the token in the header of your Request:
Authorization: 'Bearer <your-token>'
Please be advised that by default Accept-Tokens in Viya have a validity of 12 hours so you will either implement a token refresh or have your Viya admins issue a token that has a longer lifetime.
I'm no C# programmer but it should look a little something like this:
var client = new RestClient("https://sasviya.test.com/SASJobExecution/?_program=/Projects/MyOrg/ExpenseReport"); client.Timeout = -1; var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer <your-token>"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);
Cheers,
David
Oh okay, I'm sorry I guess I miss understood the use case. Going around the login of SAS Viya is of course dangerous because then the link can be shared with anyone in your organization and they can open up the report and if there is row level security on the table this gets even worse.
Just a reminder I'm sure you know what you are sharing with the users. You have to ensure that Guest Access is enabled for your SAS environment, then Copy Link of the VA report you want to be accessible through your application and enable guest access (see Screenshot). Clicking on that link should open the report directly without a login.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!