Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging WebApi2 Login (/Token) endpoint

Using .NET WebApi2: I am getting an 500 internal server error when attempting to log in to a WebApi, at the /Token endpoint.

I know there are some configuration parameters in Startup.Auth, but is there anyway I can set a breakpoint, or otherwise see what is showing up on the server? (say, before the authentication check happens, and after -- not looking for a Fiddler type intercept solution).

like image 608
ASX Avatar asked Jul 11 '14 08:07

ASX


People also ask

What is access token endpoint?

The token endpoint is where apps make a request to get an access token for a user. This section describes how to verify token requests and how to return the appropriate response and errors. Authorization Code. Password Grant. Client Credentials.


2 Answers

debug GrantResourceOwnerCredentials method in Providers/ApplicationOAuthProvider.cs

like image 74
Toolkit Avatar answered Oct 06 '22 01:10

Toolkit


You can configure Visual Studio to break on all exceptions and then obtain more information about your error when it throws.

In Visual Studio 2013, debug menu, Exceptions, mark both ckecks related to CLR exceptions as shown in the image:

enter image description here

like image 31
Iván Sainz Avatar answered Oct 06 '22 00:10

Iván Sainz