API call to validate the auth code hanging indefinitely (DUO Universal Prompt)?

Hi, we’ve implemented DUO Universal Prompt in a .Net web app using the .Net DuoUniversal library 1.1.3 published on Nuget.

The whole back and forth works great. However, in the very last step where we attempt to exchange the authorization code it just hangs indefinitely.

We don’t need async so we’re just calling as such:
idToken = duoClient.ExchangeAuthorizationCodeFor2faResult(code, username).Result

Stepping though the code… once we reach that line above it will just disappear in there and never come back.

Watching the traffic w/ Fiddler (https-decrypting proxy) I see the https tunnel gets setup… but I don’t see any additional traffic taking place.

Any ideas?

I’ve yet to attempt to look through the document on how to make the call outside the library. Guessing there is a rest, etc. call supposed to be happening behind the scenes. I’ll probably look at that as well but it would be great if the library just worked.

Thanks for any thoughts.

So, I grabbed a copy of the library from git hub so I could step through the code.

In the screenshots below you can see I’ve followed the duoClient.ExchangeAuthorizationCodeFor2faResult() call all the way into a DoPost() method.

Looks like a standard post to me… and it just hangs on the line highlighted in yellow… it just never comes back. So odd.

Any ideas?

Ok, following up.

The issue was on our side. Apparently using the .Result() as a cheat to call the async method from a non-async method was causing a repeatable deadlock.

We wound up just making the chain of calls async all the way through and everything is working great.

Thanks for coming back to share your solution.

1 Like

I found a different solution that doesn’t require changing the entire stack to async calls. In our case we couldn’t do so because then you can’t access session data.

    var token = Task.Run(async () =>
        return await duoClient.ExchangeAuthorizationCodeFor2faResult(context.Request["code"], username);
1 Like

Hi @cerverojj, welcome back! Thanks so much for sharing your additional solution!