Bitbucket如何在通过api上传文件时替换基本身份验证?
主要尝试使用基本身份验证进行身份验证。到 2021 年 10 月为止,它在生产中运行得很好。后来它被标记为已弃用。我尝试用 Base64 编码的用户名+应用程序密码替换基本凭据,之前是 Base64 编码的用户名+明文密码,但没有成功。
builder.addFormDataPart("message", pushModel.getMessage());
builder.addFormDataPart("branch", pushModel.getBranch());
builder.addFormDataPart(pushModel.getThemeConfigPath(), updatedContent);
RequestBody body = builder.build();
HttpUrl.Builder urlBuilder = HttpUrl.parse(urlString).newBuilder();
String url = urlBuilder.build().toString();
Request request = new Request.Builder().url(url).header("Authorization", "Basic ***********").post(body).build();
Response response = client.newCall(request).execute();
有一些选项可以使用 oauth 进行身份验证,但此 api 调用发生在后端,无需 ui 交互。所需要做的就是从该应用程序上传文件,而前置步骤是对其进行身份验证。
Primarily tried to authenticate with Basic auth. this was working very well in production till October 2021. Later this was marked as deprecated. I tried to replace the basic credentials with base64 encoded username+app password which earlier was base64 encoded username+plaintext password, yet no luck.
builder.addFormDataPart("message", pushModel.getMessage());
builder.addFormDataPart("branch", pushModel.getBranch());
builder.addFormDataPart(pushModel.getThemeConfigPath(), updatedContent);
RequestBody body = builder.build();
HttpUrl.Builder urlBuilder = HttpUrl.parse(urlString).newBuilder();
String url = urlBuilder.build().toString();
Request request = new Request.Builder().url(url).header("Authorization", "Basic ***********").post(body).build();
Response response = client.newCall(request).execute();
There are options to authenticate with oauth but this api call happens in the backend without ui interraction. All that is required is to upload a file from this application, and the prestep is to authenticate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论