Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,618
Community Members
 
Community Events
176
Community Groups

Pipe "Trigger pipeline 0.3.0" is using wrong account for Auth

Edited

Hi,

I'm trying to run, from my pipeline, a pipeline from other repo using the pipe "Trigger pipeline 0.3.0".
Both repositories belongs to a Team.
The pipe requires an app password which can not be generated for the team, so I've generated it in my own account with ALL the permissions checked (just for testing).

When I try to run the pipe I always get the following error:

DEBUG: https://api.bitbucket.org:443 "POST /2.0/repositories/TEAM/REPO/pipelines/ HTTP/1.1" 401 0
✖ API request failed with status 401. Check your account and app password and try again.

If I change the "account" parameter and set my user I have the same error:

DEBUG: https://api.bitbucket.org:443 "POST /2.0/repositories/MY_USER/REPO/pipelines/ HTTP/1.1" 401 0
✖ API request failed with status 401. Check your account and app password and try again.

I think it is maybe not using the right user for login.

Anyway, I think it would be better to use OAuth credentials over App passwords so it could be run over the team account and not in my personal one.

I've tried this from command line, with OAuth credentials for the Team account, and it seems to work properly:

apt update && apt -y install jq

ACCESS_TOKEN=$(curl -s -X POST -u "$BITBUCKET_OAUTH_KEY:$BITBUCKET_OAUTH_SECRET" https://bitbucket.org/site/oauth2/access_token -d grant_type=client_credentials | jq -r ".access_token")

curl -X POST -is -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" https://api.bitbucket.org/2.0/repositories/TEAM/REPO/pipelines/ -d '
{
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master"
}
}'

2 answers

I was able to run trigger-pipeline:3.0.0 with an individual account. This has different options than the 0.3.0 version you are using so maybe just moving to the latest may resolve your problem. 

https://bitbucket.org/atlassian/trigger-pipeline/src/master/

+1 for the experiment with OAuth for the team account.

0 votes

Hi @Iván Arias , thanks for your research and suggestion. We're currently considering adding support for using OAuth credentials in the pipe. So chances are that upcoming version will have it.

Hello Alexander, I am having the same issue (error 401) on trigger-pipeline:4.2.1, using OAuth credentials. Does it work now by any chance?

Thank you in advance.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events