Project
YouTrackSharp
Priority
Normal
Type
Bug
State
Fixed
Assignee
Hadi Hariri
Subsystem
No subsystem
Fix versions
No Fix versions
Affected versions
No Affected versions
Fixed in build
Next Build
  • Created by   Stephan Burg
    22 months ago (27 Jul 2011 07:38)
  • Updated by   Hadi Hariri
    21 months ago (06 Sep 2011 04:19)
 
YTSRP-8 Authentication drops?
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
Im trying to create a simple test: authenticate and create 2 issues. But on second CreateIssue method I got InvalidRequestException "Forbidden". If authenticate again before it, it works. Am I missing something?

var connection = new Connection("domain.name", 8080);
connection.Authenticate("root", "password");
var issueManagement = new IssueManagement(connection);
var issue = new Issue
{
    Assignee = "Unassigned",
    Summary = "...summary...",
    Description = "...description...",
    ProjectShortName = "1",
    Type = "Feature"
};
var issue2 = new Issue
{
    Assignee = "Unassigned",
    Summary = "...summary2...",
    Description = "...description2...",
    ProjectShortName = "1",
    Type = "Feature"
};
issueManagement.CreateIssue(issue);
// connection.Authenticate("root", "password"); // if uncomment, it works!
issueManagement.CreateIssue(issue2);
Comments (3)
 
History
 
Linked Issues (?)
 
TeamCity Changes (1)
 
Phil Collins
  Phil Collins
09 Aug 2011 15:14
22 months ago
I see the same problem when creating a new issue and then attaching a file to it.

If I fail to re-authenticate before calling "AttachFileToIssue" then I get an authorisation failure.

' Connect to YouTrack server
Dim YT_Connection As New Connection("server", 8080)
YT_Connection.Authenticate("user", "pass")

' Create the issue
Dim NewIssue As New Issue() With {
   .Description = "This is a test issue designed within a prototype to test auto submission of tickets.",
   .Summary = "A test issue",
   .ProjectShortName = "ENV",
   .Type = "Bug"
}

' Create an instance of IssueManagement and send it the issue
Dim YT_IssueManager As New IssueManagement(YT_Connection)
Dim YT_TicketID As String = YT_IssueManager.CreateIssue(NewIssue)

' getScreenshot() takes a screenshot and returns a filename with full path
Dim ScreenshotFilename As String = getScreenshot()

' If I remove this call to Authenticate then the AttachFileToIssue will fail with "Unauthorized Unauthorized" error from EasyHTTP
YT_Connection.Authenticate("user", "pass")

' Attach file to new ticket
YT_IssueManager.AttachFileToIssue(YT_TicketID, ScreenshotFilename)
Hadi Hariri (Admin)
  Hadi Hariri (Admin)
19 Aug 2011 06:43
21 months ago
What version of the server are you running against? I'll try and reproduce this.
Phil Collins
  Phil Collins
05 Sep 2011 16:28
21 months ago
I'm currently running YouTrack 3.0.2 (build #1651 [13-Jul-2011 20:22] )