I'm writing my own Visual Studio startpage for personal use, and want to embed my open Jira tickets there using the Atlassian SDK nuget package. However, I'm setting it up as a more generalized project, so I can share it with interested colleagues. This means that the username and password used to connect are given by the user on first use and may not be correct. On incorrect logins, I want to give the user the ability to change the given username or password, but to do this I need to know that that was the actual problem in the first place.
Tests show me that giving an incorrect username or password throws an Exception with message "The request was aborted: The connection was closed unexpectedly.". How can I check if this was a problem with authentication or some other issue?
I've noticed that, when there's no internet connection available, the exception's message is "The remote name could not be resolved: 'mycompany.atlassian.net'". So I could filter those out to be a bit more sure, but this doesn't look like a good solution to me.
I'm using this code to fetch my issues:
var jira = Jira.CreateRestClient("https://mycompany.atlassian.net", $"{_username}@mycompany.com", _password);
var issuesForUser = jira.Issues.Queryable.Where(issue => issue.Assignee == _username).ToList();
Any help is greatly appreciated.
Hello,
I am not sure about the library which you are using but maybe you could make a call to auth/1/session. I think you can get a more meaningful exception from this REST API call. You can read more about auth/1/session here:
Thanks for the fast response! I (wrongly) assumed that the nuget package was an official Atlassian one. After checking out the source, I can see that it actually uses the .NET rest client to make normal rest calls (and does so poorly). The link you've provided is a lot more useful. Thanks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am call http://myserver.co.kr/rest/auth/1/session
but server only return 404 not found error
hot to fix it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.