|
|
刚毅的海龟 · 426 Upgrade Required ...· 2 月前 · |
|
|
含蓄的米饭 · WebAssembly App Error ...· 1 月前 · |
|
|
安静的小熊猫 · Bug in MS Access ...· 3 周前 · |
|
|
打盹的地瓜 · 电影中的吸烟镜头是否该被限制?看看各国都是怎 ...· 1 年前 · |
|
|
霸气的大蒜 · 新疆14家旅行社组团赴阿拉木图踩线 - ...· 2 年前 · |
|
|
帅气的企鹅 · 粉色系 - 萌娘百科 万物皆可萌的百科全书· 2 年前 · |
|
|
踏实的碗 · Java中检查字符串是否以特定字符结尾-Fi ...· 2 年前 · |
|
|
温文尔雅的皮蛋 · 《达人秀卡友长路漫漫伴你闯》第6集在线观看_ ...· 2 年前 · |
|
|
活泼的金针菇
3 年前 |
|
|
含蓄的米饭 · WebAssembly App Error - These requirements were not Met RolesAuthorizationRequirement in Microsoft E 1 月前 |
|
|
安静的小熊猫 · Bug in MS Access Error message: The Data has been changed. "Another user edited this record and save 3 周前 |
|
|
霸气的大蒜 · 新疆14家旅行社组团赴阿拉木图踩线 - 中国一带一路网 2 年前 |
|
|
帅气的企鹅 · 粉色系 - 萌娘百科 万物皆可萌的百科全书 2 年前 |
|
|
踏实的碗 · Java中检查字符串是否以特定字符结尾-Finclip 2 年前 |
i changed to user DataOutputStream, and removed setRequestProperty calls. It works now.
All Answers
You need to urlencode your parameter values. You also shouldn't wrap the outputStream in a dataOutputStream that's a java specific format, just do getOutputStream.write(sb.toString().getBytes("UTF-8"))
I changed to use encode the parameter values, and removed DataOutpuStream. It still doesn't work. Following are the updated codes.
i changed to user DataOutputStream, and removed setRequestProperty calls. It works now.
Hi, I am having the same problem.
Here's my code:
My user and password are my login credentials to sales force, what am I doing wrong?
Any help or guidance is greatly appreciated.
Regards,
Martin
Edit:
More Info:
I've tried making a post through Poster ( an addon for Firefox to make http requests ) and this is the output:
<?xml version="1.0" encoding="UTF-8"?><OAuth><error>invalid_grant</error><error_description>authentication failure - Failed: API security token required</error_description></OAuth>
When you're making a username/password authentication request (whether it be via the password grant in OAUth2 or the login call in the SOAP API), if the request is from outside of the organizations configured trusted network, you'll need to additionaly specify the users API security token. See the online help for Identity confirmation. (instead of password=password you want password=passwordSecurityToken
I am getting the same problem.
I tried with changing password with security token but it doesn't work.I also rested my security token and put the new value, but it doesn't works. Do you have any other suggestion? Thanks in advance
Hi
I am getting code using oauth and then using Code to get accessToken
here is my code
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
httppost.addHeader("Content-Type", "application/x-www-form-urlencoded");
// Request parameters and other properties.
List<NameValuePair> params = new ArrayList<NameValuePair>(2);
params.add(new BasicNameValuePair("code",code));
params.add(new BasicNameValuePair("grant_type","authorization_code"));
params.add(new BasicNameValuePair("client_id",clientId));
params.add(new BasicNameValuePair("client_secret",clientSecret));
params.add(new BasicNameValuePair("redirect_uri",redirectUri));
try {
httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Getting 400 Bad request.
Can any one help me?