ID3242: The security token could not be authenticated or authorized error in Report Designer (Dynamics 365, CRM 2016 Online)

While working on Report we suddenly started getting the below error

The strange thing was that the other reports that were using the same data source in the same Report Project were working properly.

Find few posts

but none applied here.

Tried creating a new data source, entered credentials repeatedly but nothing worked, eventually restarted the SQL Server Data Tools (IDE) and it fixed the issue.

Hope it helps..


Validating Input Parameters in SSRS

We recently developed a report which had Days Input Parameter in it. Now the requirement was if the user enters any thing other then number (integer) over there they should get the appropriate error message.

Here if we define the Days parameter of type Integer and if we enter say for e.g. value = ‘x’ over there

We will get the following error message.

And if we upload the same report in the CRM, we will get the following error message, which doesn’t seem that user friendly.

Now to display proper error message to the end user we can take the following approach.

Change the parameter type to Text first. (From integer type)

Add a text box to report to show the error message, have following expression. If the value entered for Days parameter is not of numeric type display error message.

To hide the table if the Days field is not numeric, set the Hidden property with the following expression. If the Days parameter value is not numeric then hide the table.

And the following change in the DataSet’s query

Original Query

Name, lss_First_Name, lss_Last_Name


WHERE (DATEDIFF(day,CreatedOn,GETDATE())@Days)

New Query

If Days is not a numeric field then then modified select query to retrieve blank data from the table (using createdon field null criteria here in our case)



@SQL ‘SELECT Name, lss_First_Name, lss_Last_Name FROM Account WHERE (DATEDIFF(day, CreatedOn, GETDATE())) >’+Convert(nvarchar,@Days)+




SET @SQL=‘SELECT Name, lss_First_Name, lss_Last_Name FROM Account WHERE createdon=Null’



The report with proper Days value for e.g. 1

If entered incorrect Days value for e.g. abc

Helpful post

Hope it helps.