Digital Assistant and Mobile

Get Involved. Join the Conversation.


    Sunil Kumar
    How to pass authorization token to Rest Connector as header
    Topic posted July 24, 2018 by Sunil KumarRed Ribbon: 250+ Points, last edited July 31, 2018 by Arijit ChakrabortyBronze Trophy: 5,000+ Points, tagged API, Bots, Mobile, OMCE 
    320 Views, 2 Comments
    How to pass authorization token to Rest Connector as header


    Thank you community in advance, i am facing below issue followed documentation as well but no help.

    How to pass  AUTHORIZATION TOKEN as header to a Rest Connector (token got from calling another component) 

    1. I defined one Rest Connector (name - "UiPathAuthConnector") in MCS with Rest URL -->  "https/rest_url" (this is sample url just for ex)

    2. Now I created Api with 2 components

    • GetAuth Component (Post Call) -> In this component I am calling the connector & passing username & password in body(as it is post call) to get a token  
      var mobileSdk = conversation.mobileSdk;
      var body = {
      "tenancyName": "somevalue",
      "usernameOrEmailAddress": "somevalue",
      "password": "somevalue"
    'UiPathAuthConnector', '/api/account/authenticate', body, { inType: 'json', versionToInvoke: '1.0' }).then(
      function (result) {
      //code to get the parse result & get authorization token (let it be authToken)
    • GetRelease Component (Get Call) -> In this component i need to pass the authorization token (authToken got from previous step) as authorization header,
    I have tried following approach but getting error
    NOTE : I am able to do this using postman
    var headers = { "Authorization": `Bearer ${authToken}` };
    var mobileSdk = conversation.mobileSdk;
    mobileSdk.connectors.get('UiPathAuthConnector', '/odata/Releases', null, { inType: 'json', versionToInvoke: '1.0', externalAuthorization: `Bearer ${authToken}`}, { headers: headers }).then(
    function (result) {
    // after result code goes here

    As you can see i have tried externalAuthorization(following -- ) but still getting 401 authentication error.

    Please any help will be very useful

    Thanks in advance




    • Abhishek Singh

      Hi Sunil,

      I am also facing same issue and there is another thread too. You can have look at it and see if you are able to connect the dots as i am looking for answer too.

      Post: Failing to create connector to call CX Cloud REST api in MCS
      Please share if you are able to crack the puzzle.
      • Sunil Kumar

        Hi Abhishek,


        I have gone through the post you shared here.  There Frank is referring to externalAuthorization to be used in options in MCS code. 

        Actually I tried that approach before but some how not getting result. Ideally when we provide the auth token in externalAuthorization it should work. But for some reason it was not working for me. 

        Any way for work around instead of calling the MCS connector I used nodejs request module & passed the auth token there & getting response. But its just a work around.


        Do let me know if you found the solution to your issue :)