Home > database >  DocuSign OAuth Code grant Authentication callback UrL not found
DocuSign OAuth Code grant Authentication callback UrL not found

Time:03-16

I have a web application that has a public pages and a secure administrative part. For the public pages I'm using JWT authentication and DocuSign embedded signing, this is working fine. Now I'm adding an administrative section that I want to use Authorization Code Grant. I have the authentication code copied from your launcher-csharp sample application. The login action is doing the Challange() and I get the DocuSign login. The problem is that I'm not getting the OAuth OnCreatedTicket event. What is happening is Docusign is returning the callback url and my application is throwing a 404 not found on /ds/callback? My application is an asp.net 6. I'm using DocuSign.eSign.dll 5.9.0. When debugging the DocuSign launcher-csharp sample app the services.AddAuthentication and services.AddOAuth code is executed on startup. But in my test app the AddAuthentication and AddOAuth breakpoints aren't hit on startup, but only when I do a login Challange(). I think this my be the problem could the OAuth middleware events are not getting registered?

CodePudding user response:

You need code link this in startup.cs:

    .AddOAuth("DocuSign", options =>
    {
        options.ClientId = Configuration["DocuSign:ClientId"];
        options.ClientSecret = Configuration["DocuSign:ClientSecret"];
        options.CallbackPath = new PathString("/ds/callback");

        options.AuthorizationEndpoint = Configuration["DocuSign:AuthorizationEndpoint"];
        options.TokenEndpoint = Configuration["DocuSign:TokenEndpoint"];
        options.UserInformationEndpoint = Configuration["DocuSign:UserInformationEndpoint"];

CodePudding user response:

I found my error. I must have looked at this many times. In the startup.cs I had app.UseAuthorization();. I replaced it with app.UseAuthentication(); and everything works. Stupid me.

  • Related