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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,601
Community Members
 
Community Events
176
Community Groups

I can't request bitbucket rest api with right username and password, and the status code is 403.

Edited

hello!

when I use bitbucket rest api like https://api.bitbucket.org/2.0/repositories/{workspace}/ to get repositories, the return status code is 403 and content is 'b'Too many invalid password attempts. Log in at https://id.atlassian.com/ to restore access.\n''.

But my username and password is right , I can use them login  https://id.atlassian.com/ through broswer.

I use python package requests do my request, the code like this:

from requests.auth import HTTPBasicAuth
import requests

username = "{username}"
password = "{password}"
email = "{email}"
worksapce = "{worksapce}"
BITBUCKET_URL = "https://api.bitbucket.org/2.0"
BITBUCKET_AUTH = HTTPBasicAuth(username, password)
BITBUCKET_HEADERS = {"content-type": "application/json"}

response = requests.get(f"https://api.bitbucket.org/2.0/repositories/{worksapce}/",
params={
"pagelen": 100
},
auth=BITBUCKET_AUTH,
headers=BITBUCKET_HEADERS)

print(response.status_code)

print(response.content)
print(response.json())

please help me! Any help would be highly appreciated.

Thanks in advance!

1 answer

1 accepted

0 votes
Answer accepted

Hey Yue!

 

The error which you have specified indicates to me that Git is unable to authenticate the password associated with the user.
I have some suggestions:
  1. Reset the password associated with the account if you intend to use regular username/password basic auth (this is being deprecated on 01/03/22): https://id.atlassian.com/login/resetpassword 
  2. If this does not work, instead of using the normal account password can you try setting up an App Password and replacing the basic password with the app password?
    https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/
  3. To set up the App Password, you can navigate to the account settings here once logged into that account - https://bitbucket.org/account/settings/app-passwords/
    You can create the App Password and give it the permissions it needs accordingly.
-
If the regular password has been changed instead (option 1), please ensure it is cleared from any applications/GIT clients, keychain access (Mac), credential manager (Windows), deleted from /etc/shadow directory (Linux).
Let me know if this helps.
- Ben (Bitbucket Cloud Support)

Thank you for your help! Your second resolution can work, first not!

Thank you again!

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events