How to do User Login into Web Api 2

by sunil ravulapalli /18. December 2013 08:22 /asp.net-web-api /Comments (0)


Do a HTTP POST to the URL

http://localhost/token

with the HTTP HEADER

content-type: application/x-www-form-urlencoded

and HTTP BODY

username=johnsmith&password=supersecret&grant_type=password

You should get HTTP RESPONSE 200 and return data as

{
    "access_token":"zt3Ma_gzOxRi53YgCciMe1H1j6Uss...........",
    "token_type":"bearer",
    "expires_in":1209599,
    "userName":"sunil",
    ".issued":"Tue, 17 Dec 2013 17:58:05 GMT",
    ".expires":"Tue, 31 Dec 2013 17:58:05 GMT"
}
blog comments powered by Disqus