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

Setting branch-restrictions via api with 2fa

steventhefirst February 8, 2019

Hiya, I'm using bitbucket cloud and I was previously using a powershell script to hit /branch-restrictions with a POST to set a few branch restrictions on new branches created via the script.

This used to work fine, but now with 2fa I can't seem to find a way without getting a 401 response. I understand my main password won't work now, but even a fully scoped app password doesn't work either?

This is a pretty important part of our workflow to protect branches from history rewrites etc. Please don't tell me I have to disable 2fa to be able to set some restrictions on a branch now?

1 answer

0 votes
Alastair Wilkes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 8, 2019

Hi Steven,

Thanks for your question.

even a fully scoped app password doesn't work either

That's very odd; app passwords are intended for that purpose, so if they're not working, that's a problem!

It might be good to open a support ticket with the exact calls (passwords redacted, of course) you're making so we can take a look at your specific case.

Alastair

steventhefirst February 13, 2019

Hiya,

Thanks for your reply. The powershell script is using basic auth, which as I just discovered on your authentication docs isn't allowed on 2fa enabled accounts. 

I can kind of see this from a security point of view. Trying to write a powershell script that uses oauth 2 is a bit of a pain, especially as the password grant flow doesn't allow the use of app passwords. Not quite figured out how I can have it hit a redirect url from a powershell script without doing something a bit horrible...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events