Reputation: 11
Is it possible to check the scope / permissions of the private token that we connect to gitlab? In the bash script I would like to check if I can create a branch with the token that I authorize. This command only returns me a list of all tokens, and I would like to check what washing is the one that authorizes.
curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/personal_access_tokens"
Upvotes: 1
Views: 899
Reputation: 1323045
You would need to add some post-processing to your curl, after getting your GitLab token ID:
curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
"https://gitlab.com/api/v4/personal_access_tokens" | \
jq '.[] | select(.id == ${GITLAB_TOKEN_ID}).scopes'
Upvotes: 1