Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can not login Jira with Api

hania noor
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 16, 2022

I have this code below, i need to login but Jira documantation so bad that i cant figured out, how can i login to jira ? They say basic auth is depreced but all examples are like this. How can i login ?

string apiUrl = @"https://MYDOMAIN.atlassian.net/rest/api/3/issue/MYPROJECTNAME";

            using (var httpClient = new HttpClient())
            {
                using (var request = new HttpRequestMessage(new HttpMethod("GET"), apiUrl))
                {
                    var base64authorization = Convert.ToBase64String(Encoding.ASCII.GetBytes("MYEMAIL@gmail.com:1xzyNAGgksdfgP3155"));
                    request.Headers.TryAddWithoutValidation("Authorization", $"Basic {base64authorization}");

                    var response = await httpClient.SendAsync(request);

                }
            }

 

1 answer

0 votes
Fabio Racobaldo _Catworkx_
Community Champion
April 16, 2022

Hi @hania noor ,

welcome to the Atlassian community!

Please, use the following link to put in place a basic authentication https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/

The correct URL should be https://your-domain.atlassian.net/rest/api/2/issue/createmeta

Hope this helps,

Fabio

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events