Mohammed Hafiz
Mohammed Hafiz

Reputation: 1

Authorization Error in AWS Chalice: 'User is not authorized to access this resource' when Adding Dynamic Endpoint

I'm encountering an error in my AWS Chalice application:

User is not authorized to access this resource

when trying to access a newly added API endpoint: GET/employee_data/{employee_id}/download/.

Previously, my application was working fine with the following authorization setup:

api_list = ["/employee_data/employee_name/details", "/employee_data/employee_status"]
AuthResponse(routes=api_list, principal_id=decoded_token["employee_name"])

However, after adding the new endpoint, authorization is failing with the expanded API list:

api_list = ["/employee_data/employee_name/details",
            "/employee_data/employee_status",
            "/employee_data/{employee_id}/download"]
AuthResponse(routes=api_list, principal_id=decoded_token["employee_name"])

The {employee_id} value is dynamic and obtained from the API request. How can I troubleshoot and fix this authorization issue to enable access to the /download endpoint based on the employee_id?

Upvotes: 0

Views: 47

Answers (0)

Related Questions