These instructions are for Confluence Server/Data Center. If you’re using Confluence Cloud, this use case is handled automatically.
You can use two options to access file content:
Use real Bitbucket account (which is not recommended for security reasons)
Use App passwords (https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html)
Only permission required for OAuth customer or App password is Repository Read
App passwords and regular credentials should be entered in user/password fields (Username is the actual user name in both cases).
URL to use
Unfortunately, raw links (which are provided in the user interface) don't work correctly with OAuth and App passwords (as of April 2019).
You should use links to api.bitbucket.org :