Create User SSH Keys

Hey,

Currently User SSH Keys cannot be created over the API with an oAuth token. When you do so, the API returns:

{
  "type": "error",
  "error": {
    "message": "This API is only accessible with the following authentication types: session, password, apppassword"
  }
}

It appears that this was possible in v1 of the API but was removed in v2. We cannot use Deploy Keys as we also need write access.

Thanks,

James

1 Like

+1 This would be really useful

Sorry, I forgot to add… this would bring Bitbucket closer to parity with GitHub and GitLab which both allow this.

Not having this feature is also impacting our customers as they’re manually needing to perform a step which we should be able to automate for them.

Hi @jbrooksuk

Thanks for reaching out. I have passed on this feedback to our Bitbucket Cloud team. I will let you know in this thread once I have an update on this from the team.

Thanks :slight_smile:

Hi,

I got an update from our team.

This was removed from v2 due to some security concerns. If this feature is needed, our team will have to take a deeper look into it to come up with a solution.

I have raised a feature request for this here - [BCLOUD-20427] Ability to create SSH keys via OAuth token in v2 API - Create and track feature requests for Atlassian products.. Please feel free to add comments, watch and vote for the feature.

Thanks.

Hey,

This is definitely needed. What’s the security risk that resulted in this being removed?

Both GitHub and GitLab have this.

Thanks,

James

I think you can use access_tokens (see section 5 - Bitbucket Cloud JWT Grant (urn:bitbucket:oauth2:jwt)) to both pull and push git repos. A bit further down on that same page it describes repository cloning, but if the branch permissions are set correctly you should be able to push as well.