Open Closed

401 Authorization error is keep coming #9851


User avatar
0
manas-patnaik_HON created

Hi We are getting below error and refresh token is getting expired and token has been revokes successfully error appearing when we browse from the menu item. On the application TAB OF BROWSER token is getting cleared every time requesting for api. [ { "code": "Volo.Authorization:010001", "message": "Authorization failed! Given policy has not granted.", "details": null, "data": null, "validationErrors": null } ]


5 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • The error message Volo.Authorization:010001 ("Authorization failed! Given policy has not granted.") typically means the current user or token does not have the required permissions for the API endpoint being accessed.

    • If your refresh token is expiring or being revoked, and tokens are cleared every time you request an API, this is often related to authentication or cookie/session issues, especially in browser-based applications.

    • Common causes and solutions:

      1. Token/Permission Issues: Ensure the user has the correct permissions and roles assigned for the API endpoint.
      2. Token Storage: Make sure your access and refresh tokens are stored securely and persistently (e.g., localStorage, sessionStorage, or cookies) and are not being cleared unintentionally (such as on page reload or navigation).
      3. SameSite Cookie Policy: Modern browsers enforce stricter cookie policies. If you are using cookies for authentication, you may need to adjust the SameSite attribute. See the official ABP article for handling SameSite cookie issues, especially for Chrome and Safari:
      4. Token Expiry: If your refresh token is expiring too quickly, check your IdentityServer or OpenIddict configuration for token lifetimes and adjust as needed.
    • Steps to resolve:

      • Verify user permissions and API policies.
      • Check how tokens are stored and ensure they persist across navigation.
      • Review and update your authentication cookie settings for compatibility with all browsers.
      • Adjust token lifetimes if necessary.

    Sources:


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    manas-patnaik_HON created

    It did not solve the problem

  • User Avatar
    0
    manas-patnaik_HON created

    [ { "code": "Volo.Authorization:010001", "message": "Authorization failed! Given policy has not granted.", "details": null, "data": null, "validationErrors": null } ]

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share the full debug logs (logs.txt) of all your projects?

    https://abp.io/support/questions/8622/How-to-enable-Debug-logs-for-troubleshoot-problems

    You can delete the logs.txt and reproduce the problem, then share it with liming.ma@volosoft.com

    
    var loggerConfiguration = new LoggerConfiguration()
        .MinimumLevel.Debug()
        .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
        .Enrich.FromLogContext()
        .WriteTo.Async(c => c.File("Logs/logs.txt"))
        
    
    IdentityModelEventSource.ShowPII = true;
    
    IdentityModelEventSource.Logger.LogLevel = EventLevel.Verbose;
    var wilsonTextLogger = new TextWriterEventListener("Logs/identitymodel.txt");
    wilsonTextLogger.EnableEvents(IdentityModelEventSource.Logger, EventLevel.Verbose);
    

    Thanks

  • User Avatar
    0
    manas-patnaik_HON created

    I have shared the logs over the email

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 04, 2025, 16:11