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 Desktop

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.
Agol New Item

Choose ‘Application' 
AGOL Application Type

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

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

After saving, the new application will be 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.
AGOL Overview


2. Create a Web Service in FME Desktop
 
Open FME Workbench. 
 
Go to Tools, then select FME Options… Find and select Web Connections, then select Manage Services...
Manage Web Services

Click on the "+" drop-down menu in the bottom left corner and then Create From > Esri ArcGIS Online
Create Webservice

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

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.
Copy Paste Client Secret and ID
 
3. Create a Web Connection in FME Desktop
 
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. 
Add Web Connection 

Select the Web Service created in Step 2 and give your web connection a name. Click on Authenticate.
Authenticate Connection

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!
ESRI Authentication Window

4. Test the Web Connection
 
In FME Workbench, add an Esri ArcGIS Online (AGOL) Feature Service Reader to the canvas.
  
Click Parameters. In the Parameters, choose your new ArcGIS Online Web Connection. Click the ellipsis (...) to choose the feature service and layer(s) you want to read. Click OK on the Parameters and OK again to create the reader.
Add Reader with AGOL Conn

Run to test that the reader works! 
Run Workspace

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

Part 2: FME Server

 We will go through a few extra steps to get this working in FME Server.
 
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). 
Manage AGOL App

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/
Application URL

Under Redirect URLs, click Add and add your FME Server OAuth URL in the form of: http://<yourServerhost>/fmeoauth. Click Save
AGOL URI




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

In the Publish Wizard, choose your FME Server web connection and click Next. Choose a Repository to upload the workspace to (or create a new one) and Next again. 
Publish Repository

Upload the connection to FME Server by selecting it and clicking Next.
Publish Connection

Click Publish.
Finish Publish

3. Add the Redirect URI

Log into your FME Server. From Files and Connections, select Web Connections. Click Manage Web Services.
Manage Webservices

Click on your Web Service name
Edit Webservice

In the Redirect Uri, enter the same FME Server OAuth URL that you added to the ArcGIS Online Application in Step 1. Click OK.
Add URI to FME Server Web Service

Return to the Web Connections page and click on the Web Connection.
Edit 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.
Authorize Connection


4. Run the Workspace on FME Server
 
Finally, let’s run the workspace to confirm the connection is working on FME Server. 

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.