私は通常、私が答えを見つけることができるので、ここでは質問しません。しかし、この瞬間に私は見つけられませんでした。そして、私は本当に立ち往生しています。 Cherwell APIのアクセストークンを取得しようとすると問題が発生しました:http://13.88.176.216/CherwellAPI/Swagger/ui/index#!/Service/Service_Token私はこのコードを生成するためにpostmanを使用しました:RestSharp Oauth2認証Cherwell安らかなAPI
これはCherwell Service ManagementのV8 + REST APIに関連しています。サーバーの実行時例外がスローされます
コード:
string user = "myUser";
string password = "myPassword";
var client1 = new RestClient("http://13.88.176.216/cherwellapi/token?auth_mode=Internal");
client.Authenticator = new HttpBasicAuthenticator(user, password);
var request1 = new RestRequest(Method.POST);
request1.AddHeader("content-type", "application/x-www-form-urlencoded");
request1.AddHeader("cache-control", "no-cache");
request1.AddParameter("application/x-www-form-urlencoded", "grant_type=password&client_id=my_client_id&client_secret=my_client_secret", ParameterType.RequestBody);
IRestResponse response = client1.Execute(request1);
事は、私が闊歩のUI(http://13.88.176.216/CherwellAPI/Swagger/ui/index#!/Service/Service_Token)から同じメソッドを実行したときに、私はすべてのエラーを取得せずにトークンを取得することができます。 CURLにおける要求の
詳細: 受け入れる」--header:
カール
カール-X POST "アプリケーション/ x-www-form-urlencodedでのContent-Type" --headerアプリケーション/ JSONはgrant_type =パスワード&のclient_id = my_client_id & client_secret = my_client_secret &ユーザ名= my_user_name &パスワード= my_passwordという " "http://13.88.176.216/CherwellAPI/token?auth_mode=Internal"
リクエストURL」-d" http://13.88.176.216/CherwellAPI/token?auth_mode=Internal
これが闊歩のUIテストからの応答体である、ではない私のコード:
{
"access_token": "the_acces_token",
"token_type": "bearer",
"expires_in": 1199,
"refresh_token": "the_refresh_token",
"as:client_id": "client_key",
"username": "user",
".issued": "date",
".expires": "other_date"
}
すべてのヘルプは理解されるであろう。