Check access to a project using REST APIs
Hosting
CLOUD
Problem
A project is not accesible using the Projectrak REST API, even the owner of the Projectrak token seems to have the permissions needded:
Jira: Browse projects
Projectrak: View project values
Projectrak: Edit project values
The returned error is like:
Reference
Requirements
Projectrak API token
If you don’t have a Projectrak API token yet, follow the first steps (1 to 5) of this link .
If you have already got it, you can reuse it.Â
Jira API token
If you have already one, you can reuse it if not expired. Please, check it here.
If you don’t have a Jira API token yet, please go to this link and generate it.Once created the Jira API token, open a Linux terminal and execute this command to generate a base64 authentication string:
echo -n JIRA_USER_EMAIL:JIRA_API_TOKEN | base64
For Windows powershell, please refer this link.
Â
Finally copy the result string, please.
Â
Checks
Get the a JWT from Projectrak using the Projectrak API token
Using a REST client like Postman or Insomnia, call to the following Projectrak endpoint: /api-keys/jwt and copy the JWTDecode the JWT and get the user "accountId"
Use the following util page: https://jwt.io/Get the Atlassian "accountId" for your user
Call to the fowlloing Jira endpoint: /rest/api/3/myself.
Use the Jira API token genereated.Check both 2 & 3 steps "accountId" are the same
If not, the Projectrak API token you're using belongs to other user.
If they're the same cotinue checking next stepCheck projects with the "BROWSE_PROJECTS" permission using the Jira API
The "BROWSE_PROJECTS" is a Jira permission needed to access a Project.
Call to the following Jira endpoint: /rest/api/3/permissions/project, specifying the permissions to check.
Use the Jira API token generated.
Check if the target project is in the results.
If not there, please check the project permission for the user using the Jira instance Web interface.Get the project using the Jira API
As you've checked projects with "BROWSE_PROJECTS" permission you should get the project.
Call to the following Jira endpoint: /rest/api/3/permissions/project
Use the Jira API token generated.Get the project using the Projectrak API
If you get the Project using the Jira API, you also should get it using the Projectrak API
Call to the following Projectrak endpoint: /search/projects?pql="key" IN ("<projectKey>")
Use the Projectrak token generated.Check Projectrak permissions on project
Check the user permission to operate with Projectrak:Projectrak: View project values
Projectrak: Edit project values
Projectrak: Switch layout
Reference: Projectrak permissions approach
Call to the following Projectrak endpoint:Â /permissions/projects/<projectId>
Use the Projectrak token generated.
Â
Â
Related articles
Â
Â
Â