SimpleTokenProvider icon indicating copy to clipboard operation
SimpleTokenProvider copied to clipboard

400 response instead of 401 in GenerateToken() function

Open onedevteam opened this issue 9 years ago • 1 comments

            var identity = await _options.IdentityResolver(username, password);
            if (identity == null)
            {
                context.Response.StatusCode = 400;
                await context.Response.WriteAsync("Invalid username or password.");
                return;
            }

I think response should be 401/Unauthorized, because request is good/valid.

onedevteam avatar Mar 15 '17 22:03 onedevteam

This response is modeled after the OAuth 2.0 error response, which returns 400 for invalid credentials.

I just realized that the response body isn't proper, though. I'll fix that. 👍

nbarbettini avatar Mar 16 '17 17:03 nbarbettini