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

2 posts, 0 answers
  1. Gurpreet
    Gurpreet avatar
    19 posts
    Member since:
    Nov 2018

    Posted 05 Dec 2018 Link to this post

    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?

  2. Todor
    Todor avatar
    488 posts

    Posted 10 Dec 2018 Link to this post

    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.

    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
Back to Top