User login endpoint (POST Method)
https://developer.api.yodlee.com/ysl/restserver/v1/user/login如何从xamarin表单添加页眉和参数休息服务C#
采样输入
cobrandName作为路径参数传递
cobSession作为认证头
通过登录名和密码作为表单参数传递
cobrandName =所述cobrand
LOGINNAME = TESTUSER
密码的名称= Yodlee123
授权:{cobSession = 06142010_1:6666b4df326b8a26d6263054bdc4d1725d075230a082b8059ad7c20777b65d836b4eaa2dbf69169a448162c0ea09223012f130934cdee19114577f4c4a66c209}
所以这是样本数据API的数据。我已经做了很多职位来api到我自己的服务器,但从来不得不添加标题..有点困惑?
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);
我可以让我的第一个电话和填充模型。但后来我需要再次发送与sessionid(令牌),但我需要将其插入到标题。我的sessionid返回将是下一个postasync的授权ID。
我认为正确的做法是这样的
httpClientUser.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("userSession", TheObject.session.cobSession);
我在正确的轨道上?
我需要创建 HttpContent httpContent = new StringContent(json);
如何创建格式
我需要发送3个参数 我需要添加返回的会话ID的授权头?
感谢
编辑
这里是即时通讯研究 https://developer.yodlee.com/Yodlee_API/Getting_Started
需要添加参数 需要添加AUTH头 的网址,然后发布
UPDATE
我已经结束了与此
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);
使用ARC上我能得到的回应一样credentails
它仍然无法正常工作......。
,但通过应用程序传递值不起作用