When this library tries to access the updated file contents on line 197 using Bitbucket's API endpoint, a 401 Unauthorized error is returned.
Notes:
This only happens when using Bitbucket's app password with Basic authentication even when you've granted it all OAuth scopes/permissions.
On the contrary, no issues are experienced if you use your main Bitbucket login account password. Keep in mind that using the main Atlassian account password has been deprecated in favor of "app passwords".
Create an app password and give it the relevant "OAuth scopes/permissions". I granted mine to have ("pipeline", "webhook" & "repository"). On save, copy the auto-generated app password.
Description:
Notes:
This only happens when using Bitbucket's app password with Basic authentication even when you've granted it all OAuth scopes/permissions.
On the contrary, no issues are experienced if you use your main Bitbucket login account password. Keep in mind that using the main Atlassian account password has been deprecated in favor of "app passwords".
Solution:
I managed to resolve this issue by removing the "!" sign from the endpoint routes. https://bitbucket.org/!api/2.0/repositories/test7_wanchai/test-indent/src/2e39c147293f02648190ad62f64cb6e443f6bd6a/dummy-1000.txt
Steps to reproduce the issue:
Create an app password and give it the relevant "OAuth scopes/permissions". I granted mine to have ("pipeline", "webhook" & "repository"). On save, copy the auto-generated app password.
Try accessing the endpoint to retrieve a file on your remote Bitbucket repository using Basic authentication with the "app password" and your "username".
Here is a script to list all recently committed files in my test repo. List of updated committed files wanchai-ftpbucket.
Here is a script that tries accessing one of my file contents. It will throw a "401 Unauthorized error". 401 Unauthorized wanchai-ftpbucket.
To resolve the error, remove the "!" sign from Line 6 (CURL URL) and run the script again. https://gist.github.com/steven7mwesigwa/c0bd9a5624349ac7d25d22c866ab3ace#file-401-unauthorized-wanchai-ftpbucket-L6