restibm-mobilefirstworklight-adaptersworklight-security

How to enter user credentials when calling password protected URL from a worklight adapter?


I want to call a rest service via http adapter. I do a get request to the url of the rest service but it is in a password protected domain. (if i try to access the url from browser it pops up a window for username and password.) How can i pass these credentials along with my get request? do i have to make a post request before that?


Solution

  • Use the element of the HTTP adapter.

    <authentication>
      <basic/>
        <serverIdentity>
          <username> ${user} </username>
          <password> ${password} </password>
       </serverIdentity>
    </authentication>  
    

    It will pass the network credential while accessing the service url.