docusignapi

How to obtain the docusign user guid to set on the JWT sub attribute?


It seems that I am missing a piece in the JWT Consent Flow.

  1. I craft the following consent url and link it to a button that will open a popup for the current user to login and accept the consent: https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id=#{my_integration_key}&redirect_uri=#{redirect_url}"
  2. Once redirected, the documentation specifies that I should simply ignore the code param in the redirect url.
  3. I must create a JWT token in order to obtain an access token : At this point I must specify the 'sub' with the user ID of the user who just granted consent. How I am suppose to get it in this flow? I don't understand why I should ignore the code param in the oauth redirect, I should use it to find the DocuSign user guid.

Am I missing something ?


Solution

  • The userId GUID can be obtained in many ways, but that depends on the flow of your app.

    You could go to check it in the Settings (admin) portion of the web app, either in the "Apps and Keys" page, where you get the logged in user ID, or in the "User" where you can find any and all users in the account.

    However, if you want to do that programmatically, you are in a catch22, as to make an API call to obtain this information you need to first be authenticated. Typically, this can be done by hardcoding a primary user (system user) that was set manually and that user then make API call to obtain all other users and their GUID (userID) respectively.