Reputation: 698
It seems that I am missing a piece in the JWT Consent Flow.
Am I missing something ?
Upvotes: 0
Views: 168
Reputation: 1125
You can add two steps to the JWT authorization flow to query the user ID.
The redirect to the /oauth/auth
(step 1) request will contain a code
query parameter. This is a JWT that can be used in an /oauth/token
request (grant type authorization_code
) documented here:
https://developers.docusign.com/platform/auth/authcode/confidential-authcode-get-token/#RequestCode
The response to the /oauth/token
request will contain an access token that can be used to make a /oauth/userinfo
request. The sub
prop in the response is the user ID.
https://developers.docusign.com/platform/auth/reference/user-info/
Once you have sub
, you have everything you need to create a JWT and request a new access token.
Upvotes: 0
Reputation: 14050
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.
Upvotes: 1