Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

docusignapi - Docusign error "consent required" when trying to authenticate with jwt

I know it's recommended to use Authorization Coe Grant, but I'm running into authentication issues when I try to implement JWT auth.

try
            {
                _docusignAuthenticationService.AuthenticateFromJwt();
            }
            catch (ApiException apiExp)
            {
                // Consent for impersonation must be obtained to use JWT Grant
                if (apiExp.Message.Contains("consent_required"))
                {
                    return Redirect(BuildConsentURL());
                }
            }

private string BuildConsentURL()
        {
            return "https://account-d.docusign.com/oauth/auth" + "?response_type=code" +
                "&scope=signature%20impersonation" +
                "&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +
                "&redirect_uri=" + "http://localhost:63849";
        }

Am I missing a step in configuring my account to use JWT?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

JWT requires each user consent once for a given app (based on the IK). This can be done per user, or using admin consent - for the entire org. Larry blog post talks all about it. Your code looks correct. Did you hit the exception? did the browser open and ask your for consent? and if so - did you then try again? using the same account?

Update: the issue has to do with having different scopes for consent vs. when making the JWT token request. The set of scopes must be the same and must always include "impersonation."


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...