Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

REST API authentication with Google Account Edited

Hi community,

I use a Google Account to login to my companies Bitbucket Cloud instance.

Now I want to query the repository list with the BitBucket Cloud REST API but ran into 401 response: Unauthorized. I've tried to query repo list of my account and also for my company.

I use Basic Auth and send:

  • Google Username + Password (as I login via Browser)
  • Google Username + App Password

I call the following:

GET: https://api.bitbucket.org/2.0/repositories/romanwolf

GET: https://api.bitbucket.org/2.0/repositories/<company_name>

Without authentication I get at least the open repositories in my account. But I want all (public + private).

What am I missing?

 

Any feedback is welcome,

Roman

1 answer

1 accepted

1 vote
Answer accepted

Hi Roman,

Atlassian cloud uses google for SSO but your bitbucket password won't be same as Google. Hence, to use the API, you can't use your google password.

You can reset your bitbucket password using this link: https://bitbucket.org/account/password/reset/

This won't affect your SSO with Google.

You can also look into alternative authentication methods for Bitbucket REST API; https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication

Hope this helps.

Thanks,

Ankit

Hi Ankit,

thanks for the reply. Reseting my password does not work for me (no email with link received).

I am already successful using the REST API of JIRA and Confluence using Basic Auth and Atlassian API token.

Unfortunately it does not work out with Bitbucket the same way :(

If I want to use OAuth as you suggested I need to register an app somehow to retrieve client id/secret and so on. Currently I have no clue how to do that.

 

Regards,

Roman

Hi Roman,

 

You can use app passwords. which are like API tokens in bitbucket. You can use it instead of your Bitbucket password in basic authentication. 

Generate your app password here: https://bitbucket.org/account/settings/app-passwords/

Here's an article on App Passwords:

https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/

 

Thanks,

Ankit

Hi Ankit,

I already played around with App password, but it does not work out either. I received 401 Unauthorized also for Basic Auth with my username and my app password.

It's a bit mystique as it was fairly easy to use the REST API of JIRA and Confluence.

Are there settings on some upper level which might cause this trouble on my side?

 

Thanks,

Roman

Hi Roman,

It is possible that the issue here is with the username. You mentioned in your question that you use your Google username. You need to use your Bitbucket username instead for authentication, as it is listed here after you log in to Bitbucket Cloud:

Is this something that works for you, with the Bitbucket username + app password?

Kind regards,
Theodora

Like Sean Conaty likes this

Oh yes! That could be the thing. I didn't think of the username part.

Hi @Theodora Boudale ,

That was the mistake, now I receive 200 and the response.

I just copy/paste of what I was using with JIRA/Confluence where my Google username is valid to be used.

Its a bit confusing that the same approach does not work out with bitbucket.

 

Finally it got solved.

 

Thanks a lot to both of you,

Roman

Like Theodora Boudale likes this

Suggest an answer

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

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

504 views 6 4
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