Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Help logging in to Jira online over c#



Need some help to understand and how to fix this when trying to connect to jira over c#. 

url format is:


String baseURL = "";
String loginAPI = "auth/1/session";


Whenever I try to execute this, I get a 401. I've tried using my email with api key, username without email format with api key, and both with password and all get a 401... Totally clueless.


public void loginToJira()

try {

WebRequest request = WebRequest.Create(this.baseURL + this.loginAPI);
String postData = "{\"username\":\"" + this.loginUsername + "\",\"password\":\"" + this.loginPassword + "\"}";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = byteArray.Length;

Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);

WebResponse response = request.GetResponse();
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
String responseFromServer = reader.ReadToEnd();
this.loginResponse = responseFromServer;

catch (Exception ex)
string texto = ex.Message;

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,441 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you