Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

API Token Expiry #8600


User avatar
0
nitinrpatel created

Hello, I have created a Mobile Application for my portal using the same API which I had used for my portal. I am using below mentioned API for Login, the issue is that after every 15-20 minutes the token which is generated after login is getting expired. I have to re-login after every 15-20 minutes. I want to change this scenario, I want to stay logged in the App until I manually do not get logout from the App.

{{site_url}}/api/Account/Authenticate
{
	"usernameOrEmailAddress":"#######",
	"password":"#######"
}

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team
    • What is your product version?
    • What is your product type (Angular or MVC)?
    • What is product framework type (.net framework or .net core)?

    Is your mobile application Xamarin?

    .net framework version token is valid for 30 minutes by default.

    https://github.com/aspnetzero/aspnet-zero/blob/e730d0a890bea0618fa3c7d6d099b676c06e7f90/src/MyCompanyName.AbpZeroTemplate.WebApi/WebApi/Controllers/AccountController.cs#L50

  • User Avatar
    0
    nitinrpatel created

    I am using ASP.NET MVC 5.x with AngularJS version. And Mobile Application is developed in IOS Native and Android Native.

  • User Avatar
    0
    maliming created
    Support Team

    ASP.NET MVC 5.x token is valid for 30 minutes by default.

    You can change this time or replace it with another solution that supports refres token. eg use Identity Server.

    In the net core version, zero implements the refresh token, you can check its code if needed.

    https://github.com/aspnetzero/aspnet-zero/blob/e730d0a890bea0618fa3c7d6d099b676c06e7f90/src/MyCompanyName.AbpZeroTemplate.WebApi/WebApi/Controllers/AccountController.cs#L50

    https://docs.aspnetzero.com/en/aspnet-mvc-angularjs/latest/Development-Guide-Mvc-Angularjs#token-based-authentication