Best Practices for Connecting to Enterprise Portal in R?

83
2
Tuesday
Labels (2)
KevinBoes2
New Contributor

I work in an organization with many R users and comparatively few ArcGIS users. We manage our GIS data within an enterprise, and we have an enterprise agreement to manage licensing. We would like to take advantage of the arcgis meta-package to give our R users access to data and locator services hosted in our enterprise portal, and we're hoping to avoid relying on authentication through ArcGIS Pro credentials since most of the R users don't have that software or license.

I've been following the "Introduction to the R-ArcGIS Bridge" course offered by Esri in their training catalog, and it outlines granting access to an enterprise portal using an OAuth 2.0 application. While this process worked for me, I am having trouble figuring out how to help other users use this application to connect to our enterprise within their scripts. My impression is that these OAuth 2.0 application items are designed to be used for web applications rather than R scripts or notebooks which are stored locally. 

I would like to facilitate a process where our R users make use of a user authentication process to connect to our enterprise portal using their own login credentials. Should I be using an OAuth 2.0 application for this process, or is there a better practice for granting access to an enterprise portal in R for multiple users?

2 Replies
EricaNova
Frequent Contributor

@KevinBoes2 , I'm going to PM you - I've been struggling to get this to work in a web application (Shiny) and would really appreciate it if you could share a working demo. My goal is to allow staff to connect to their accounts in a Shiny application. Do you think your workflow would be appropriate for this purpose? I've been back and forth with Josiah Parry (package author) but still not having any luck.

0 Kudos
KevinBoes2
New Contributor

After doing some digging through documentation, I found that the function I'm using to authenticate with our portal, arcgisutils::auth_code(), only requires an ARCGIS_CLIENT value and ARCGIS_HOST url to be set in the R environment to successfully authenticate the user's portal credentials. If I'm interpreting Esri's OAuth 2.0 documentation correctly, the Client ID that populates this ARCGIS_CLIENT value is essentially an identifier for the auth_code() function to use when locating the authenticator app within the portal. If so, it seems like I can provide this Client ID and our portal url to users for them to include in their R environment with minimal risk of releasing sensitive information about the authenticator or items within our portal that are not shared with their user.

Are there any security concerns with this approach that I might be missing?

0 Kudos