Connecting to REST with OAuth 2.0

Connecting to REST with OAuth 2.0

OAuth 2.0 is an authorization protocol that allows applications to access user data from other services without sharing the user’s credentials. It enables users to securely grant limited access to their resources on one service to another application.

This connector allows you to configure static REST authenticated connections that you can reuse on other parts of the platform where a REST connection to the connected REST API service is required.

What is OAuth 2.0?

OAuth 2.0, which stands for “Open Authorization,” is a standard designed to allow a website or application to access resources hosted by other web apps on behalf of a user. It replaced OAuth 1.0 in 2012 and is now the de facto industry standard for online authorization. OAuth 2.0 provides consented access and restricts the client app’s actions on resources on behalf of the user without ever sharing the user’s credentials.

Why is a Connection required?

A Connection is required to allow Appenate to communicate with your OAuth 2.0 account before you can successfully add Form Connectors to push data or pull data with Data Source Connectors from other platforms.

Adding a REST Connection

The Data Hub area of the platform is where you can add connections for connectors. Navigate the side menu to Data Hub > Connections.

On the Connections page:

  • Click the ADD CONNECTION button in the top-right-hand corner to bring up a list of connections.
  • Click on the REST option.

Authenticating

Once you’ve added the REST connection, you can configure either a regular Auth Request connection or an OAuth 2.0 connection that can be reused by any other form that requires the same connection.

You can select which authentication method your REST Connection will support by selecting the appropriate one, as shown in the screenshot above.

Adding an Auth Request Connection

This option allows you to configure a REST connection that utilizes either API key-based authentication, Basic authentication, or Token-based authentication. You can configure these authentication methods here for reuse on other forms or data source connectors you wish to use.

Target URL

Enter the request destination URL.

If you wish to substitute part of this URL with the Global Forms REST URL, you can use the {{GLOBAL}} placeholder. e.g. {{GLOBAL}}/api/endpoint

Headers

Provide custom request headers that will be included in all requests using this connection.

Body

When establishing authentication, provide the request payload to be sent with POST/PUT/PATCH requests.

You can insert values from the response of the Auth Request step ($response) into the body by using formula functions such as JSONVAL(), JSONLIST(), XMLVAL(), or XMLLIST().
e.g. {(JSONVAL($response, ‘path.to.property’))}

Using the above response in headers/query parameters below

The result from the REST step above is returned as $response for use in the connection headers and query parameters.

Access properties or lists of elements from JSON responses via the JSONVAL() and JSONLIST() formula functions.

Similarly, for XML responses, use XMLVAL() and XMLLIST().

e.g. {(JSONVAL($response, ‘path.to.property’))}

Query Parameters

Provide custom query parameters that will be included in the URL of all GET requests using this connection.

Adding an OAuth 2.0 Connection

Once you’ve selected the option to add an OAuth 2.0 Connection, fill in the required properties and save. This will reload the interface with an Authorize button that you will need to press to sign into the 3rd party service and authorize the connection so that our platform can push or pull data from your account.

Authentication URL

Enter the URL where users will be directed to authenticate. Example: https://some-service.example/oauth2/authorize

Auth Code Request

Add all the query parameters needed for a code request. We automatically add the response_type=code and redirect_uri parameters to the request.

Token URL

Enter the URL used to exchange the authorization code for an access token. Example: https://some-service.example/oauth2/token

Token Request

Add all the query parameters needed for a token request. We automatically add the request’s redirect_uri, grant_type=authorization_code, and code parameters.

Callaback URL

The REST service will call back to the URL once the authentication is successful.

https://eforms.mobileform.net/oauth2/restcallback

The OAuth2.0 access token will be included in headers automatically 

An ‘Authorization: Bearer *****‘ header will be included in all requests using this connection

If your connection is authenticated successfully, the red block showing Cannot Connect will change to green and show Connected. At this point, your REST connection is ready to use on your forms and data sources.

    • Related Articles

    • Data Source Connector – REST

      The REST Data Source Connector allows you to pull data from an external API into a data source and populate its rows/columns for use in screens. This connector functions similarly to our REST Field (in-app REST requests) that can push or pull data ...
    • Task Connector – REST

      REST Task connectors allow you to send data to third-party applications that support REST API on a Task’s event if the assigned user changes, the status updates, or the Task becomes overdue. You define these REST connectors on Task Templates. Adding ...
    • Form Connector – REST

      This Connector will be interesting if you have access to technical personnel (software developers) and want to tightly integrate with our platform. The REST Connector will automatically send form entry data in XML or JSON format to your specific web ...
    • REST Field

      The REST field type enables you to issue a REST request in JSON or XML to an external web service and pull data from any API. The result of the request is stored in the REST field, and you can then access the result’s values through our existing ...
    • External User Connector – REST

      Authenticate your users against an external system, such as a web service or enterprise identity provider. When external auth is configured, user passwords are never stored on our platform. Azure AD is being renamed to Microsoft Entra ID. When logged ...