How to Create an ArcGIS Online Web Connection (OAuth 2.0)

Matt Meeboer
Matt Meeboer

FME Version

Introduction

ArcGIS Online supports OAuth 2.0 authentication. This article explains how to set up an ArcGIS Online Web Application and an FME Web Connection for FME to connect using OAuth 2.0.

If you are trying to create an ArcGIS Enterprise Portal Web Connection, please use this article instead: How to Create an ArcGIS Enterprise Portal Web Connection (OAuth 2.0)

Step-by-Step Instructions

Part 1: FME Form

1. Create an Application in ArcGIS Online

Let's start by creating an ArcGIS Online application that will be used in the FME Web Connection.

Log into ArcGIS Online and go to the Content view. Click on New item.




Choose ‘Application'




From the list of Application types, choose Other application. Click Next.




Finally, enter a Title and Tags (optional). Click Save to create the application.




After saving, the new application landing page will open. (You can also find it on your contents page if you need to access it in the future.)

The Overview displays the credentials needed to configure the FME ArcGIS Online Web Service, which is used to create Web Connection. These credentials are also available from the Settings page. Keep this page open, as you will need to copy and paste the credentials into FME.





2. Create a Web Service in FME Form

In FME Workbench, open the drop-down Tools menu and select FME Options. Navigate to Web Connections, then click Manage Services.




Click on the "+" drop-down menu in the bottom left corner (1) and then Create From (2) > Esri ArcGIS Online (3).




Give the Web Service a name. It’s good practice to include the service, “ArcGIS Online”, in the name.




Copy and paste the Client ID and Client Secret from the ArcGIS Online Application Overview page into the corresponding fields in the Web Service. Click Apply, then Close.




3. Create a Web Connection in FME Form

After closing the Web Services page, you should be back Web Connection page. If you aren’t, go to Tools > FME Options > Web Connections to reopen it. Click on the “+” button to add a new connection.


 

Select the Web Service created in Step 2 and give your web connection a name. Click OK to authenticate.




This will open a prompt from ArcGIS Online. Enter your ArcGIS Online Account credentials, or click your account if using SAML (single sign on), and click Sign In. After successfully signing in, your ArcGIS Online Web Connection is ready to use!




4. Test the Web Connection

In FME Workbench, add a Reader to the canvas. Set the Format to Esri ArcGIS Online (AGOL) Feature Service (1), then click Parameters (2).

In Parameters, select your new ArcGIS Online Web Connection (3). Click the ellipsis (...) to choose the feature service (4) and layer(s) (5) you want to read. Click OK to save the parameters, then click OK again to create the reader.




Run to test that the reader works!




If you are also using FME Flow, keep the workspace open, as we will use it to configure FME Flow in the next part.

Part 2: FME Flow

We will go through a few extra steps to get this working in FME Flow.

1. Add a Redirect URI to the ArcGIS Online Application

Go back to your ArcGIS Online Application and click Manage next to Credentials (you can also click Settings from the top menu bar).




Enter an Application URL. FME does not use this URL, but ArcGIS Online requires it before saving Redirect URIs. Enter any HTTPS URL; for example: https://www.arcgis.com/




Under Redirect URLs, click Add (1) and enter your FME Flow OAuth URL in the form of: http://<yourServerhost>/fmeoauth (2). Click Save.




2. Upload the Web Connection and Web Service to FME Flow

Back in FME Workbench, let’s publish the workspace to FME Flow to upload the Web Connection and associated Web Service. Click the Publish button in the top right.




In the Publish to FME Flow window, select a valid FME Flow Connection and choose a Repository to upload the workspace to (or create a new one). Click Next.




Ensure that the ArcGIS Online web connection is selected, then click Next.



We only require the Job Submitter service for this exercise. Ensure it is selected, then click Publish.


 

3. Add the Redirect URI

Log in to FME Flow. Expand the Connections & Parameters menu, select Web Connections, and click Manage Web Services.




Click on the Web Service that you created to edit its parameters.




In the Redirect URI field, enter the same FME Flow OAuth URL that you added to the ArcGIS Online Application in Step 1. Click OK.




Return to the Web Connections page and click on the Web Connection.




Click Authorize. When prompted, enter your ArcGIS Online credentials, or click your account if using SAML (single sign on), and click Sign In. After successfully authorizing your connection, you should see a green checkmark next to the web connection name. Click OK.




4. Run the Workspace on FME Flow

Finally, let’s run the workspace to confirm the connection is working on FME Flow.


From the side menu, click Run Workspace. Find the workspace that was just uploaded. Then, click Run to run the workspace. The workspace should run successfully, demonstrating that the connection works.

Was this article helpful?

Comments

1 comment

  • Hi, I've recently done this to try to produce a more stable connection into ArcGIS Online. When I test the Web connection in FME Form and Flow, it works fine when and successfully authenticates. However, when I attempt to connect via a FeatureReader, I receive the following error:

    "Python Exception: <FMESDException>: Type: 4, Number: 1, Message: Failed to get authorization query string."

    It seems there are a few queries being raised about this throughout Safe's web forum. Is there a common fix for this, as it seems odd?

    0

Please sign in to leave a comment.