The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

artizirk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 21, 2019

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
artizirk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 5, 2020

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.

TAGS
AUG Leaders

Atlassian Community Events