User login endpoint (POST Method)
https://developer.api.yodlee.com/ysl/restserver/v1/user/login
Sample Input
cobrandName is passed as path parameter
cobSession is passed as Authorization Header
loginName and password are passed as form parameters
cobrandName = name of the cobrand
loginName=testuser
password=Yodlee123
Authorization:{cobSession=06142010_1:6666b4df326b8a26d6263054bdc4d1725d075230a082b8059ad7c20777b65d836b4eaa2dbf69169a448162c0ea09223012f130934cdee19114577f4c4a66c209}
so this is the sample data api data. i've done many posts to an api to my own server but never had to add headers.. and a little confused?
var httpClient = new HttpClient();
var json = JsonConvert.SerializeObject(t);
HttpContent httpContent = new StringContent(json);
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
//httpContent.Headers.Add()
var result = await httpClient.PostAsync(WebServiceUrl, httpContent);
var RegisterResponse = await result.Content.ReadAsStringAsync();
CobrandLoginModel TheObject = JsonConvert.DeserializeObject<CobrandLoginModel>(RegisterResponse);
i can make my first call and populate the the model. but then i need to send off again with the sessionid(token) but i need to insert it into a header. my sessionid returned will be the authorization id for the next postasync.
i think the correct way is this
httpClientUser.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("userSession", TheObject.session.cobSession);
am i on the right track??
do i need to create the HttpContent httpContent = new StringContent(json);
how do i create the format
i need to send 3 parameters i need to add the authorization header of the returned sessionid?
thanks
EDIT
here is the url that im studying https://developer.yodlee.com/Yodlee_API/Getting_Started
need to add parameters need to add a auth header then post
UPDATE
I've ended up with this
var httpClientUser = new HttpClient();
var UserJson = JsonConvert.SerializeObject(newuser);
HttpContent httpContentUser = new StringContent(UserJson);
httpContentUser.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
var createTheToken = "cobSession=" + TheObject.session.cobSession;
var check = httpClientUser.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Authorization", "{" + createTheToken + "}");
var CompleteResult = await httpClientUser.PostAsync(YodleeUserLoginUrl, httpContentUser);
var RegisterResponseUser = await CompleteResult.Content.ReadAsStringAsync();
YodleeUserModel LoggedInUser = JsonConvert.DeserializeObject<YodleeUserModel>(RegisterResponseUser);
it still does not work... using the same credentails on ARC i can get the response.
but passing the values via the application does not work