Sample Plugin to Obtain Access Token (Client Credentials)

This topic outlines how a plugin, such as the Sample Plugin, can use the configured Oracle Fusion Field Service application (for Client Credentials flow) to obtain an access token using the "getAccessToken" procedure. The process is the same as for the User Assertion flow.

Initial Application List

Upon initialization, the plugin receives a message containing a list of available applications. This message includes the resourceUrl field for each application.

The resourceUrl is obtained from the plugin's configuration and is used by the Sample Plugin in its subsequent API requests.

The following screenshot illustrates the Initialization data, showcasing how the plugin obtains and employs the resourceUrl field from its configuration during the initialization process.


This screenshot shows the Sample Plugin initiqlization data section.

Obtain an Access Token

To acquire an access token using the Sample Plugin, you need to utilize the Procedures functionality as shown below in the screenshot. You can

  • Send a callProcedure method call to the plugin.
  • Within the callProcedure call, specify getAccessToken as the desired procedure.

This screenshot shows the procedure section.

Retrieve the Token

Once the callProcedure with getAccessToken is processed, the resulting access token will be available in the callProcedureResult response method as shown below:


This screenshot shows the Request response method

Validate the Token by Fetching Data

With the access token obtained, you can fetch data from a REST API to verify its validity.

fetch("https://rest-api-instance.com/rest/api", {
    headers: {
        Authorization: "Bearer <accessToken>"
    }
})
.then(resp => resp.json())
.then(json => console.log(json));