OHDSI Home | Forums | Wiki | Github

Authentication failed when accessing WebAPI using R

Hi @Ajit_Londhe ,

We are trying to access our OHDSI WebAPI via LDAP using the below command in R console


  •             authMethod = "ad", 
  •             webApiUsername = Sys.getenv("WEBAPI_USERNAME"), 
  •             webApiPassword = Sys.getenv("WEBAPI_PASSWORD"))

We have set the baseUrl, WEBAPI_USERNAME and WEBAPI_PASSWORD properly

But we are getting the below error:

Error in .authAd(baseUrl, webApiUsername, webApiPassword) :
Authentication failed.

NOTE: We’ve already configured LDAP in our environment and that is working fine with our LDAP credentials

Please help us to resolve the issue

Kavi Sambathkumar

I’m not an expert, but I think AD is different than LDAP?

@Ajit_Londhe could you confirm?

Yes, It is different
But if we use ldap, it says only db, ad and windows are supported

Ok, if that’s the case, then we just need to implement LDAP authentication to WebAPI in the R package…There is a thread for this here. We just need more help in people researching what R libs are available (or how to configure an environment with keystores/kerbros for example) to invoke each method of authentication.

I think LDAP is not solved in the R package, so we’d need some help with getting an implementation.

1 Like

Right, we need to add ldap to ROhdsiWebApi. In my GitHub Actions test coming in Broadsea 3.1, I added a curl command for ldap auth, so it’s definitely doable.

curl -d "login=user1&password=PASSWORD" -H "Content-Type: application/x-www-form-urlencoded" -X POST

I added LDAP here: https://github.com/alondhe/ROhdsiWebApi/tree/ldap

@Kavi_Sambathkumar can you try installing this version of ROhdsiWebApi and then retry, setting authMethod to “ldap”?

remotes::install_github("alondhe/ROhdsiWebApi", ref = "ldap")


Hi @Ajit_Londhe ,

It works totally fine now!
Thank you so much for the support


If I could give you 10 hearts, @Ajit_Londhe , I would.

For now, I gave you the one, and you’ll like it.


@Gowtham_Rao - should I add a PR to main or develop? Also PackageMaintenance is good for me to run for the PR?

Develop, since that repo follows R publishing procedures, which means pushing to master signals a release (which we don’t want).

I’m not sure about PackageMaintenance, but probably OK. Just set up a feature branch (off develop) and someone will be able to review if it is in complaince.

Great! Yes. Develop. Please don’t run package maintenance

1 Like

@Gowtham_Rao - looks like there’s already a PR for develop branch from the user “kalimu”:

It’s the same exact code I was going to add. Can you review/merge kalimu’s into develop?

Merged to develop


Hi there, does the ROhdsiWebApi package support Open ID authentication?