I am trying to create a teamcity project fron .net core. I have written the below code but when i am trying to run the code i get the below error
Code :
public void CreateProject(string name, string newProjectId, string parentProjectId)
{
InvokeTeamCityApi(() => _apiClient.CreateProject(new NewProjectDescription
{
Name = name,
Id = newProjectId,
SourceProject = new GetProjectResponse
{
Id = _toolContext.HostingContext.TeamCityProjectTemplate
},
ParentProject = new GetProjectResponse
{
Id = parentProjectId
},
CopyAllAssociatedSettings = true,
}));
}
Error : 403 Forbidden: CSRF Header X-TC-CSRF-Token does not match CSRF session value
Also i did a google and i tried adding the header origin but i dont have access to disable the internal teamcity properties to disable CSRF check.
So i am passing the token X-tc-CSRF-Token in the request but it says the value doesnt match. How can i solve this issue Note : I am getting this issue only when i am using bearer token and with basic auth it works fine.