Problem
When using wrong Access Tokens or improper Access permissions, nexus Lifecycle returns below error.
Symptoms
Outline possible impact on the product/behavior, which might be an indication of the problem and also if applicable any specific error messages which can be seen.
Possible causes
Issue can be due to wrong PAT or wrong access permissions to corresponding Access Token
Solution
We can use below curl command to validate the the API's that Lifecycle uses.
1. Get the profile details
curl -v -u :<new_PAT> "https://dev.azure.com/OrgName/ProjectName/_apis/git/repositories?api-version=4.0"Sample output:
{"displayName":"sappusamy","publicAlias":"dc8743b4-7e16-6bae-9a32-xxxx","emailAddress":"sappusamy@sonatype.com","coreRevision":366775647,"timeStamp":"2021-08-16T02:07:27.89+00:00","id":"dc8743b4-7e16-6bae-9a32-041a2a633398","revision":366775647}
2. Get the account details for from profile ID
curl -v -u :<new_PAT> "https://vssps.dev.azure.com/_apis/accounts?api-version=4.0&memberId=dc8743b4-7e16-6bae-9a32-xxx"Sample output:
{"count":1,"value":[{"accountId":"c73ae33c-ee52-4ba9-a8f4-xxx,"accountUri":"https://sappusamy0790.vssps.visualstudio.com:443/","accountName":"sappusamy0790","properties":{}}]}
3. Get the repo list for above account
curl -v -u :<new_PAT> "https://dev.azure.com/sappusamy0790/_apis/git/repositories?api-version=4.0"Sample output
{"value":[{"id":"e445d5e0-8dd3-4661-a1a5-xxx","name":"sri-priv-proj1","url":"https://dev.azure.com/sappusamy0790/02a6ea8c-34eb-4675-85c5-xxxx/_apis/git/repositories/e445d5e0-8dd3-4661-a1a5-xxx","project":{"id":"02a6ea8c-34eb-4675-85c5-xxx","name":"sri-priv-proj1","url":"https://dev.azure.com/sappusamy0790/_apis/projects/02a6ea8c-34eb-4675-85c5-xxx","state":"wellFormed","revision":11,"visibility":"private","lastUpdateTime":"2022-01-11T00:51:45.43Z"},"defaultBranch":"refs/heads/master","size":426,"remoteUrl":"https://sappusamy0790@dev.azure.com/sappusamy0790/sri-priv-proj1/_git/sri-priv-proj1","sshUrl":"git@ssh.dev.azure.com:v3/sappusamy0790/sri-priv-proj1/sri-priv-proj1","webUrl":"https://dev.azure.com/sappusamy0790/sri-priv-proj1/_git/sri-priv-proj1","isDisabled":false},{"id":"32d20410-e192-4a12-xxxx","name":"sri-priv-proj2","url":"https://dev.azure.com/sappusamy0790/10b93609-f28e-40d9-9137-xxx/_apis/git/repositories/32d20410-e192-4a12-bab4-xxx","project":{"id":"10b93609-f28e-40d9-9137-xxx","name":"sri-priv-proj2","description":"Srinis Private Project2","url":"https://dev.azure.com/sappusamy0790/_apis/projects/10b93609-f28e-40d9-9137-xxx","state":"wellFormed","revision":19,"visibility":"private","lastUpdateTime":"2022-01-11T01:10:11.497Z"},"defaultBranch":"refs/heads/master","size":432,"remoteUrl":"https://sappusamy0790@dev.azure.com/sappusamy0790/sri-priv-proj2/_git/sri-priv-proj2","sshUrl":"git@ssh.dev.azure.com:v3/sappusamy0790/sri-priv-proj2/sri-priv-proj2","webUrl":"https://dev.azure.com/sappusamy0790/sri-priv-proj2/_git/sri-priv-proj2","isDisabled":false}],"count":2}