This is a migrated thread and some comments may be shown as answers.

Web Service Data Source (Bearer Authentication) - Passing run-time bearer token value to Authorization Header with every API data request

1 Answer 1062 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Gurpreet
Top achievements
Rank 1
Gurpreet asked on 05 Dec 2018, 06:09 PM

We are using latest Web Service Data Source  with Bearer Authentication, and are able to get the API token on each login request and even setup the correct  TokenPath field with valid regular expression (?:"access_token":")(.*?)(?:"), but we are not able to access token value in subsequent API data request. As per our Web API requirement we have to pass the bearer token as a Authorization header in every API data request.

What is the way to retrieve run-time token value and pass this to Authorization header of each API data request?

1 Answer, 1 is accepted

Sort by
1
Todor
Telerik team
answered on 10 Dec 2018, 01:27 PM
Hello Roozbeh,

If I understood correctly, the Token for the Web Service Data Source is taken by the service itself, i.e. by the logic behind the report. In this case the Token will be available only for the purposes of the report and it is not possible to reuse it in the other part of the application.

The workaround is to retrieve the Token with a custom logic, which will allow it to be used in the entire application. The Token can be passed as a value of a parameter to the report, and used as a value for an Authorization header - check the attached screenshots.
You may use Fiddler to check the exact format of the Authorization header when using 2-step (Bearer) Authentication, and adjust the correct Header name/value if necessary.

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Report Designer (standalone)
Asked by
Gurpreet
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or