In the case of Basic Authentication and OAuth 2.0 password grant flow, it is recommended to send the values (user ID, user password, access token) from the COBOL application instead of entering the values in the configuration file. This is important because the User ID and User Password are user-specific parameters and should be managed from the COBOL application.
You can use the user ID and user password parameters specified in the COBOL copy book to send these credentials to the ePortal proxy service.
03 REFERENCESCOUNTRIESBYCOUNTRYCO REDEFINES REQ-BUFFER. 05 USER-DATA. 07 ACCESSTOKEN-LENGTH, PIC 9(5). 07 ACCESSTOKEN PIC X(100). 07 USERID-LENGTH, PIC 9(5). 07 USERID PIC X(100). 07 PASSWORD-LENGTH, PIC 9(5). 07 PASSWORD PIC X(100).
For OAuth 2.0, the access token parameter is included in the USER-DATA area of the copy book and it can be used for OAuth 2.0 supported specifications. Following are the recommended methods to handle access token for OAuth 2.0:
When you send a request to the ePortal service proxy for the first time, you should send an empty access token.
The service proxy generates an access token and saves it in the configuration file, and then sends the access token as a response to COBOL application.
In the subsequent requests, the COBOL application can use this access token. This will improve the performance of the application.
If you do not want to manage the access token, the proxy handles it internally through the configuration file.
The order of preference goes to COBOL application. If the access token is not present in the application, it checks the configuration file. If the access token is not present in the configuration file, it takes a new access token.
The proxy handles token expiry internally. For more information, refer to Access Token Expiry.