I have created my own Login Module instead of using /token. As we can see that i am returning a refresh_token which allows my access_token to get a new one. -To access my login api i request http://localhost/api/Account/LoginUser and gets access_token, refresh_token and expiry dates.
Same as my Login Module i want to implement a RefreshToken where i can return a user new access_token with extended usage time.
What i have done so far is :
[Route("RefreshToken")]
[AllowAnonymous]
public HttpResponseMessage GrantRefreshToken(OAuthGrantRefreshTokenContext context)
{
//enforce client binding of refresh token
if (context.Ticket == null || context.Ticket.Identity == null || !context.Ticket.Identity.IsAuthenticated)
{
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new ObjectContent<object>(new
{
Message = "Refresh token is not valid"
}, Configuration.Formatters.JsonFormatter)
};
}
else
{ // implement logic here}
But unable to get any context.
What i am doing wrong?? and please help me to implement it.
Thanks