# Is there a C# example for Jira.CreateRestClient that uses API Token?

**URL:** <https://community.developer.atlassian.com/t/is-there-a-c-example-for-jira-createrestclient-that-uses-api-token/49986>\
**Category:** Jira Cloud\
**Tags:** auth, csharp, api-token, dotnet, rest-api\
**Created:** [July 18, 2021, 6:45pm UTC](https://community.developer.atlassian.com/t/is-there-a-c-example-for-jira-createrestclient-that-uses-api-token/49986 "2021-07-18T18:45:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zfischer](https://avatars.discourse-cdn.com/v4/letter/z/45deac/32.png) [@zfischer](https://community.developer.atlassian.com/u/zfischer)\
**Post date:** [July 18, 2021, 6:45pm UTC](https://community.developer.atlassian.com/t/is-there-a-c-example-for-jira-createrestclient-that-uses-api-token/49986/1 "2021-07-18T18:45:54Z")

</div>

I know there are some examples for HttpRequest/HttpResponse…However I would like to see if there are any code samples that show how to use CreateRestClient with the API token in place of (URL,UserName,Password)

Basic authentication was deprecated and I do not know how to get around the error I keep getting that tells me this.

I’m using Jira NuGet package v. 12.4

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![aagrawal2](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/aagrawal2/32/40775_2.png) [@aagrawal2](https://community.developer.atlassian.com/u/aagrawal2)\
**Post date:** [July 19, 2021, 4:00am UTC](https://community.developer.atlassian.com/t/is-there-a-c-example-for-jira-createrestclient-that-uses-api-token/49986/2 "2021-07-19T04:00:37Z")

</div>

Hi @zfischer

Thanks for the question. Yes, the _basic auth with password_ is **deprecated** but there are couple of other options you have:

- Basic auth with API tokens - [Basic auth for REST APIs](https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/)
- OAuth 2.0 (also known as 3LO) - [https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/)

Although, we don’t have C# example, but these pages do a great job of explaining how each auth works, when to use them and how to make API calls using them.

Let us know if you have any more questions 🙂

---

<div class="post-metadata">

**Author:** ![Sammy](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Sammy](https://community.developer.atlassian.com/u/Sammy)\
**Post date:** [September 27, 2022, 6:24am UTC](https://community.developer.atlassian.com/t/is-there-a-c-example-for-jira-createrestclient-that-uses-api-token/49986/3 "2022-09-27T06:24:54Z")

</div>

How to use outh2 with createJiraRestClient.  
I need to return the instance same as basic authentication using OAuth2.

---

<div class="post-metadata">

**Author:** ![TalithaGohil](https://avatars.discourse-cdn.com/v4/letter/t/94ad74/32.png) [@TalithaGohil](https://community.developer.atlassian.com/u/TalithaGohil)\
**Post date:** [November 7, 2024, 3:04pm UTC](https://community.developer.atlassian.com/t/is-there-a-c-example-for-jira-createrestclient-that-uses-api-token/49986/4 "2024-11-07T15:04:56Z")

</div>

Hi, Did you manage to get outh2 to work with createJiraRestClient?

---

<div class="post-metadata">

**Author:** ![SidorelaVeiz](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@SidorelaVeiz](https://community.developer.atlassian.com/u/SidorelaVeiz)\
**Post date:** [November 11, 2024, 11:14am UTC](https://community.developer.atlassian.com/t/is-there-a-c-example-for-jira-createrestclient-that-uses-api-token/49986/5 "2024-11-11T11:14:17Z")

</div>

Hello,  
OAuth 2.0 (2LO) is still supported by Atlassian?
