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

authorizeWebApi(baseUrl,

  •             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

Thanks,
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 http://127.0.0.1/WebAPI/user/login/ldap

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")

2 Likes

Hi @Ajit_Londhe ,

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

2 Likes

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

For now, I gave you the one, and youā€™ll like it.

2 Likes

@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

2 Likes

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

t