Pratham Khodwe
08/07/2025, 5:36 PMAsk Inkeep
08/07/2025, 5:36 PMAsk Inkeep
08/07/2025, 5:36 PMdocker run -it \
-p 7766:7000 \
--env PDP_ORG_API_KEY=<YOUR_ORG_API_KEY> \
--env PDP_ACTIVE_PROJECT=<YOUR_PROJECT_ID_OR_KEY> \
--env PDP_ACTIVE_ENV=<YOUR_ENVIRONMENT_ID_OR_KEY> \
--env PDP_DEBUG=True \
permitio/pdp-v2:latest
When using an Organization API Key, you must set both PDP_ACTIVE_ENV and PDP_ACTIVE_PROJECT environment variables with the ID or Key of the environment and project you want to use .
Alternatively, you can use a Project API Key with this configuration :
docker run -it \
-p 7766:7000 \
--env PDP_PROJECT_API_KEY=<YOUR_PROJECT_API_KEY> \
--env PDP_ACTIVE_ENV=<YOUR_ENVIRONMENT_ID_OR_KEY> \
--env PDP_DEBUG=True \
permitio/pdp-v2:latest
Or use the standard Environment API Key (simplest option) :
docker run -it \
-p 7766:7000 \
--env PDP_API_KEY=<YOUR_API_KEY> \
--env PDP_DEBUG=True \
permitio/pdp-v2:latest
To help debug your issue, please share:
1. Which Workspace / Project / Env you are using
2. What calls you are performing (as SDK code or CURL)
3. Which PDP version you are running
4. Relevant logs from your PDP
This will help our engineers investigate why your keys are showing as incorrect.Ask Inkeep
08/07/2025, 5:36 PMOmer Zuarets
08/07/2025, 5:37 PMPratham Khodwe
08/07/2025, 5:43 PMOr Weis
08/07/2025, 5:46 PMPratham Khodwe
08/07/2025, 5:47 PMPratham Khodwe
08/07/2025, 5:48 PMPratham Khodwe
08/07/2025, 5:49 PMPratham Khodwe
08/07/2025, 5:49 PMOmer Zuarets
08/07/2025, 5:51 PMOmer Zuarets
08/07/2025, 5:52 PMPratham Khodwe
08/07/2025, 5:55 PMOmer Zuarets
08/07/2025, 5:56 PMPratham Khodwe
08/07/2025, 5:57 PMOmer Zuarets
08/07/2025, 5:59 PMPratham Khodwe
08/07/2025, 5:59 PMPratham Khodwe
08/07/2025, 6:00 PMOmer Zuarets
08/07/2025, 6:01 PMPDP_API_KEY env var with the env level key instead of the org level api key and the additional configuration.
It will reduce the friction here, and it works for most casesOmer Zuarets
08/07/2025, 6:01 PMdocker run -it \
-p 7766:7000 \
--env PDP_API_KEY=<YOUR_ENVIRONMENT_API_KEY> \
--env PDP_DEBUG=True \
permitio/pdp-v2:latestPratham Khodwe
08/07/2025, 6:03 PMOmer Zuarets
08/07/2025, 6:05 PMPratham Khodwe
08/07/2025, 6:09 PMPratham Khodwe
08/07/2025, 6:09 PMOmer Zuarets
08/07/2025, 6:10 PMPratham Khodwe
08/07/2025, 6:16 PMSettings > API Keys > Environment Keys which was assigned to my project
5. So the image was running correctly but when I fired the my API to check user role it failed, showing resource not found. Which means it was not able to find the user. I figured it would required some Environment Key because I had 2 envs in my project and I am using dev environment.Pratham Khodwe
08/07/2025, 6:17 PMPratham Khodwe
08/07/2025, 6:18 PMOmer Zuarets
08/07/2025, 6:19 PMdocker run -it \
-p 7766:7000 \
--env PDP_API_KEY=<YOUR_ENVIRONMENT_API_KEY> \
--env PDP_DEBUG=True \
permitio/pdp-v2:latest
After that attach a small code snippet of your permit client initialization and sdk call and the logsPratham Khodwe
08/07/2025, 6:23 PMfunc NewPermit(config config.PermitConfig) *Client {
apiClient := api.NewPermitApiClient(&config)
enforcerClient := enforcement.NewPermitEnforcerClient(&config)
return &Client{
config: config,
Api: apiClient,
Elements: apiClient.Elements,
enforcement: enforcerClient,
}
}Pratham Khodwe
08/07/2025, 6:23 PM// CheckPermission checks if a user has permission to perform an action on a resource
func (s *PermitService) CheckPermission(ctx context.Context, userID, action, resource, tenantID string) (bool, error) {
// Create user for permission check with tenant context
user := enforcement.UserBuilder(userID).Build()
// Create action
actionObj := enforcement.Action(action)
// Create resource with tenant context
resourceObj := enforcement.ResourceBuilder(resource).WithTenant(tenantID).Build()
// Check permission
allowed, err := s.Client.Check(user, actionObj, resourceObj)
if err != nil {
s.logger.Errorw("failed to check permission", "error", err, "user_id", userID, "action", action, "resource", resource, "tenant_id", tenantID)
return false, fmt.Errorf("failed to check permission: %w", err)
}
s.logger.Infow("permission check result", "user_id", userID, "action", action, "resource", resource, "tenant_id", tenantID, "allowed", allowed)
return allowed, nil
}Pratham Khodwe
08/07/2025, 6:24 PMpermit:
api_key: "" # Will be overridden by FLEXPRICE_PERMIT_API_KEY environment variable
api_url: "<https://api.permit.io>"
pdp_url: "<https://cloudpdp.api.permit.io>"
environment: "dev"
debug: false
project_id: "default"
api_key is in my env
using the enviremnet keyOmer Zuarets
08/07/2025, 6:30 PMOmer Zuarets
08/07/2025, 6:31 PMPratham Khodwe
08/07/2025, 6:45 PMPratham Khodwe
08/07/2025, 6:45 PMPratham Khodwe
08/07/2025, 6:46 PMPratham Khodwe
08/07/2025, 6:47 PMOmer Zuarets
08/07/2025, 6:50 PM