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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get BitBucket Server user ssh key using REST api and Access Tokens Bearer authentication Edited

using this command I can get a list of users in a group

curl -H "Authorization: Bearer $TOKEN" 'https://$SERVER/rest/api/1.0/admin/groups/more-members?context=$GROUP' | jq

 

But when i try to use the same TOKEN to get a ssh keys from user I get a com.atlassian.bitbucket.AuthorisationException

curl -H "Authorization: Bearer $TOKEN" 'https://$SERVER/rest/ssh/1.0/keys?user=$USER' | jq

 

Can I use Access Tokens to get user ssh keys via REST api?

1 answer

I gave up and figured out how to get oauth working with Python and Requests library.

https://gist.github.com/artizirk/538619d4a654ada9a01f3bd1670a6fa6

In the gist i have code for generating required Oauth1 RSA keys and a script for doing the Oauth dance to get required tokens. After that it is possible to use normal rest endpoints including the ssh endpoint.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,926 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you