Skip to content

Instantly share code, notes, and snippets.

@nest-don
Created August 6, 2019 12:49
Show Gist options
  • Save nest-don/8e4a3a33d547a2f9b10fd55cc7ae10d5 to your computer and use it in GitHub Desktop.
Save nest-don/8e4a3a33d547a2f9b10fd55cc7ae10d5 to your computer and use it in GitHub Desktop.
if (result.HttpStatus == System.Net.HttpStatusCode.Unauthorized)
{
/*
* The token has expired. Renew is auto-renew option
* has been requested.
*/
if (Permit != null && AutoTokenRenew)
{
if (ex.Call.Response.Headers.Contains("Token-Expired"))
{
Permit.UseRefreshToken();
ResultSingle<Permit<UserT>> renewResult = await GetAsync(Permit,
CreateRequest(Permit, true, data));
if (renewResult.Code < 0)
return result;
UpdatePermit(renewResult);
}
}
else
{
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment