使用OAuth访问私有Bitbucket原始内容

4

在Github上有一个私有仓库,我可以生成一个“个人访问令牌”

curl https://<oauth-secret>:x-oauth-basic@raw.githubusercontent.com/<me>/<repo>/master/<file>

获取文件内容。在Bitbucket中是否有相同的功能?

3个回答

2

嗨,事实证明您可以使用http(s)身份验证。

curl --user <username>:<password> https://bitbucket.org/<username>/<repo>/raw/<file>

在脚本中使用用户名和密码比令牌(可以限制权限)更容易出现安全漏洞,但在这种情况下,这样做还算是有效的。


1
根据 Bitbucket Cloud上的OAuth,您需要编写https://x-token-auth:{access_token}@bitbucket.org 以便将令牌用作密码而不是用户名。

1

使用 OAuth tokenBitbucket api,并带有 access_token 参数:

https://api.bitbucket.org/2.0/repositories/{username}/{repo_slug}/src/master/{file}?access_token={access_token}


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接