Hi Guys - I need to be able to log a user straight into the report server after authenticating with the api either in .NET or javascript and retrieving the token via the api (http://localhost:83/Token) instead of showing the login boxes.
This is a requirement because we use our own authentication mechanism in our web apps and once the user has successfully logged into our app using our authentication methods we do not want them to have to provide any further 'log in details' on the report server - Can you advise how to achieve this. I think the steps involved may be as follows:
1) user logs into our web app using there own credentials for our business.
2) use the report server API to authenticate and get the token back for an admin account set up by us on report server.
3) after successfully getting the token back, redirect the user to report server from .NET web app using a special account we set up without the requirement for them to log into report server again.
I know there is ADFS available in Telerik report server, however our domain servers are 2003 and do not support the ADFS feature offered by report server - which is why I am looking for an alternative approach.
Hope that makes sense, thanks for your help.:)
Anthony J Brown.
5 Answers, 1 is accepted
You need to authenticate only users who are considered CALs, and who will generate reports or manage resources of the Report Server. all other users can use the guest account to request preview of published reports - Guest user.
In case you need to give access to CALs through the Report Server API, please check: The admin user should create accounts for each CAL before they are able to log on the Report Server.
Regards,
Stef
Progress Telerik

Hi Stef - I understand that only CAL's users have access however I need to understand how to redirect a user to the report server without being prompted with the credentials screen having already logged in and authenticated via the report server API - for example, I have a CAL user that logs into my app via Active Directory and they already have a non AD/CAL account on the report server from which they are given the bearer token - I don't want them to have to log in twice, once in my app and then again on the report server - is there a way to bypass the login screen once the user has successfully logged in via the API from a .net app and already given the access token? Can this been achieved using HTTPContext redirect somehow?
I seem to be presented with the report server login screen every time I login via the report server API or javascript and redirect to localhost:83.
Look forward to your help with this one, many thanks
Anthony J Brown
HSS Hire
The attached demo project is a WebApplication with Windows Authentication.
In site.Master we add a link that should lead the user to the Admin Module of the Report Server, after login the user through the exposed Report Server's API:
<
div
class
=
"navbar-collapse collapse"
>
<
ul
class
=
"nav navbar-nav"
>
<
li
><
a
runat
=
"server"
href
=
"~/"
>Home</
a
></
li
>
<
li
>
<
a
id
=
"btnReportServer"
>Go to Report Server</
a
>
</
li
>
</
ul
>
<
script
>
var serverHost = "http://localhost:83/";
var serverApi = serverHost + "api/reportserver/";
var serverTokenKey = "TelerikReportServerToken";
function login(username, password) {
var accessToken = "";
$.ajax({
type: "POST",
url: serverHost + "Token",
async: false,
data: {
grant_type: "password",
username: username,
password: password
}
})
.done(function (data, textStatus, jqXHR) {
accessToken = data.access_token;
})
.fail(function (xhr, status, error) {
window.alert(xhr.status + ": " + error);
});
return accessToken;
}
$('#btnReportServer').click(function () {
var accessToken = login("telerik", "telerik123");
window.sessionStorage.setItem(serverTokenKey, accessToken);
window.location = serverHost;
});
</
script
>
<
p
class
=
"nav navbar-text navbar-right"
>
Hello,
<
asp:LoginName
runat
=
"server"
/>
!
</
p
>
</
div
>
Regards,
Stef
Progress Telerik

Hi Stef,
I am trying to access with the same way you said in Angular4 project bit showing the below error
status: 400
statusText: "Bad Request"
type: 2
: "http://localhost:83/Token"
error: "unsupported_grant_type"
Trying to send the data in below formats
1) Ajax
let = 'http://localhost:83/Token';
let data = {
grant_type: 'password',
username: 'manikanta',
password: 'tj@2018'
};
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true);
xhr.send(JSON.stringify(data));
xhr.onloadend = function (e) {
console.log(e);
};
2) Typescript:
let url = 'http://localhost:83/Token';
let body = JSON.stringify({ 'grant_type': "password", 'username': 'manikanta', 'password': 'tj@2018' });
return this._http.post(url, body)
.map((response: Response) => <any>response.json())
.catch(this.handleError);
In both the cases i am geeting same error "unsupported_grant_type"
Please provide the solution for this.
Thanks
The Stackoverflow threads {“error”:“unsupported_grant_type”} for angular call and {error: “unsupported_grant_type”} angular 5 describe similar issues. Most probably the problem is related to CORS.
You may check the exact requests made by your Angular application with Fiddler - this can give additional information.
You can also use Postman or Fiddler to make the requests to the Report Server and compare them with the ones made by the Angular application.
Regards,
Todor
Progress Telerik