It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Login Method Post Response 400 "Bad request" Edited

Iam trying to Login into a application using post API and C#

The json is formatted like this:

jsonbody = {"grant_type": "password","tenantName":"<alphanumeric Variable>","userName":"<alphanumeric Variable>","password":"<alphanumeric Variable>"}" ;

I am using this code for the login API:

var request = HttpWebRequest.Create(url);
var byteData = Encoding.ASCII.GetBytes(jsonbody);

request.ContentType = "application / x - www - form - urlencoded";
request.Method = "POST";

using (var stream = request.GetRequestStream())
stream.Write(byteData, 0, byteData.Length);
var response = (HttpWebResponse)request.GetResponse();
catch ()

I have confirmed that the Url I am attempting to post to is correct and the credentials that I am using is correct scope. What am I missing?

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Hipchat

Hipchat Cloud and Stride have reached End of Life (updated)

All good things come to an end - thanks to all our customers and partners who have been along the Hipchat and Stride journey with us.  As of Feb 15th 2019, Hipchat Cloud and Stride have reached ...

35,201 views 9 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you