OAuth 2.0, which stands for Open Authorization 2.0, is an industry-standard protocol for authorization. It allows users to grant limited access to their protected resources without sharing their credentials, such as passwords.
The main purpose of OAuth 2.0 is to enable users to give permission to access their resources hosted on one website to a different website or application, without requiring them to disclose their login credentials. It provides a secure and standardized way for clients to access resources on behalf of the user.
Current ERP Systems using OAuth2.0 Integration
The following systems are already integrated for OAuth2.0 and are easy to setup:
ERP Live customer account
Evox Order processing
Install from the App Store
OAuth Endpoint: Endpoint to retrieve tokens.
OAuth Token life: Token life time (Should be less or equal to the real time)
OAuth Grant Type: Grant type's available (Client Credentials, User&Password, Refresh Token, Client Assertion:jwt-bearer). Depending on the selected the form/payload can change.
OAuth Client ID & OAuth Client Secret: Credentials used to retrieve tokens.
OAuth Resource Body Key: For the resource atribute used on the payload we allow different keys to be used (Depending on the preference).
OAuth resource: The value of the resource server.
OAuth scope: The permissions or actions allowed (Optional field).
Refresh token: Used to refresh the access token and optionaly the refresh token (When the refresh token life time is limited).
JSONata Token Response: JSONata expression, alowing to retrieve the access token with custom body response.
JSONata Refresh Token Response: JSONata expression, alowing to retrieve the refresh token with custom body response.
Install Using Grant Type Client Assertion
By selecting the Client Assertion type, the form changes. The screenshot below shows an example of a possible integration along with an explanation of the new fields.
JWT Algorithm: JWT Algorithms available (PS256). This will be used to encode the JWT token.
JWT Header: JSON JWT Header that will be used to create the JWT token.
JWT Payload: JSON JWT Payload: this field includes all the claims for the JWT. The claims iat (issued at time), exp (expiration time), and scope will be automatically filled.
Examples Request/Response for OAuth2.0:
Depending on the Grant Type the request and response can change.
Client Credentials
Request Header
Notes:
Example Request Header: Content-Type: application/json
|
Request Body
Notes:
Example Request Body { |
Response Body
Notes:
Example Response Body { |
User & Password
Request Header
Notes:
Example Request Header: Content-Type: application/json
|
Request Body
Notes:
Example Request Body { |
Response Body
Notes:
Example Response Body { |
Refresh Token
Request Header
Notes:
Example Request Header: Content-Type: application/json
|
Request Body
Notes:
Example Request Body { |
Response Body
Notes:
Example Response Body { |
Client Assertion (jwt-bearer)
JWT Token
Note:
Code sample const jwt = require('jsonwebtoken'); |
Request Header
Notes:
Example Request Header: Content-Type: x-www-form-urlencoded |
Request Body
Notes:
Example Request Body { |
Response Body
Notes:
Example Response Body { |
FAQ
How can I remove the Client ID from the request body?
If you’re using the Client Assertion (JWT bearer), you can remove the Client ID by saving the App Store field with a space (empty character).