汇合REST API授权问题 [英] Confluence REST API Authorization issue

查看:255
本文介绍了汇合REST API授权问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有合流Atlassian的REST API认证的问题。请看看下面的C#code:

I am having issues with Atlassian Confluence REST API authentication. Please take a look at following C# code :

private  string USERNAME = "test";
private  string PASSWORD = "test";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://xxx.atlassian.net/wiki/rest/api/content?os_authType=basic&spaceKey=DEV&Title=Development&expand=space,body.view,version,container");
request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(USERNAME + ":" + PASSWORD)));
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

但是,这总是产生一个错误:{远程服务器返回错误:未经授权(401)}。

But this always produces an error : {"The remote server returned an error: (401) Unauthorized."}.

我曾尝试在同一code。与内部使用基本身份验证REST服务,并得到正确的结果。请能有人指出我是什么在这个失踪?谢谢你。

I have tried the same code with in-house REST Services with Basic Authentication and it yields correct result. Please can someone point out what am I missing in this ? Thanks.

奥马尔

推荐答案

对于任何人的利益:我是用我的电子邮件作为用户名。我曾与JIRA分配的用户名来替换它。

For the benefit of anyone : I was using my email as username. I had to replace it with the username assigned by JIRA.

这篇关于汇合REST API授权问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆