Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Error trying to retrieve access_token through OAuth2.0

I am trying to get an access token through OAuth2.0 but everytime I try to do it, I just receive the error below.

Error:: "Cannot use client_credentials with a consumer marked as \"public\". Calls for auto generated consumers should use urn:bitbucket:oauth2:jwt instead.", "error": "invalid_grant"}


I am trying to send a POST request through HTTPClient but I am not sure what I am doing wrong here.

Code below:

private static async Task<Token> GetEligibleToken()
var client = new HttpClient();
string baseAddress = "";

string grant_type = "client_credentials";
string client_id = "id";
string client_secret = "secret";

var form = new Dictionary<string, string>
{"grant_type", grant_type},
{"client_id", client_id},
{"client_secret", client_secret},

HttpResponseMessage tokenResponse = await client.PostAsync(baseAddress, new FormUrlEncodedContent(form));
var jsonContent = await tokenResponse.Content.ReadAsStringAsync();
Token tok = JsonConvert.DeserializeObject<Token>(jsonContent);
return tok;

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jun 01, 2022

Hi @tommythongsythavong

Welcome to the community.

Based on the error message, I believe you'll need to make your consumer keys private.
You'll need to tick the "This is a private consumer" checkbox similar to the screenshot below:
Here are the exact steps:

  1. Go to your workspace -
  2. Click Settings
  3. Click OAuth consumers (Under Apps and Features)
  4. Click the 3-dotted-icon next to your consumer keys > Click Edit
  5. Lastly, tick the "This is a private consumer" checkbox to make it private

Try again after that and let me know how it goes.

Mark C

Hi @Mark C


I don't know if that worked for the OP but it has just worked for me.





Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events