We have been working on org where there's a one-time manual setup page to authenticate with Docusign API using Oath flow and store the Access token and Refresh token in a custom setting. If any other VF page needs to call the Docusign API, it would get the refresh token and get the new access token do all the API calls.
1) Click on the button in VF page
2) Page redirects to the DocuSign login page
3) Integration User gives the username and password
4) Docusign ask for Grant Permission screen on click on Accept based on the callback URL configured, the page gets redirected with "code" which contains the encoded data of "access token", "refresh token"..
The client wants us to remove this one-time manual setup if possible and do all the authentication behind the scene in Apex without manual intervention
While searching different authentication flows, we came across the passing the
Username and Password in the header(https://developers.docusign.com/esign-rest-api/guides/authentication/legacy) instead of using Oath's access token but it is legacy approach and is not recommended by DocuSign
So upon searching we found JWT flow(https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-jsonwebtoken) to authenticate with DocuSign but it seems like it will ask the "Grant Permission" screen.
My question here,
Is there's a way to make the authentication flow happen in Apex without any manual user interaction? If so, can you please share how it can be done in Apex?
NOTE: Org does not contain the DocuSign package installed. Current, all the flow and access the DocuSign resource is based on custom code.