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)
-
0
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:
- Token/Permission Issues: Ensure the user has the correct permissions and roles assigned for the API endpoint.
- 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).
- 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:
- 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.
-
0
It did not solve the problem
-
0
[ { "code": "Volo.Authorization:010001", "message": "Authorization failed! Given policy has not granted.", "details": null, "data": null, "validationErrors": null } ]
-
0
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
-
0
I have shared the logs over the email