5

I am building an ASP.NET MVC Application and I need to implement OAuth authentication with Jira.

In Jira Bitbucket repository there is an example of how to configure a client with Java and other languages, but nothing for C#.

Can anyone show me an example for a Jira OAuth Client in C#?

https://bitbucket.org/atlassian_tutorial/atlassian-oauth-examples/src/0c6b54f6fefe996535fb0bdb87ad937e5ffc402d/java/src/main/java/com/atlassian/oauth/client/example/?at=default

https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-oauth-authentication/

2 Answers 2

1

I have a project using this SDK from atlassian Atlassian.NET SDK in order to get my work a little fast, it has an example of using the authentication

Example of using SDK

var jira = Jira.CreateRestClient("http://<your_jira_server>", "<user>", "<password>");
Sign up to request clarification or add additional context in comments.

Comments

0

Probably too late. I came across the internet with the same issue but no luck. So I dug into the code and have such hacky way to achieve what I needed. This is how I did for our project with the Atlassian.NET SDK

var jira = Jira.CreateRestClient(JiraHost);
jira.RestClient.RestSharpClient.Authenticator = new RestSharp.Authenticators.OAuth2AuthorizationRequestHeaderAuthenticator(_JiraToken, "Bearer");
var myself = await jira.Users.GetMyselfAsync();

Basically, the way to use oauth in this sdk is to override RestSharp object for the authentication. This could make the jira object to have enough permission to call the api.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.