• Bruce_Do
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 11
    Replies
Hi all, I'm writting a API to transfer a file to external system. In this API I will callout to other service using Http. As you all know, the HTTP request body is limit 6MB. So everything that increase the request body is very important and need to prevent.
But, when I using EncodingUtil.base64Encode to convert a file as Blob to String (as a service request). The file size increase too much. I upload a file has 1075359 bytes, but after encode it increase to 1433812
Do you know how can I prevent this. Thank.
I'm implement a Rest API that return an attachment file. But the respone always return Transfer-Encoding: chunked. As you know, with this type, the Content-Length will not return. I need the Content-Length to show progess bar at client side.
But when I change the Transfer-Encoding to other types like gzip, deflate,compress, identity. The respone always return error: We are down for maintenance.
Please help to show me the way to change this, or how can I set the Content-Length
my code code look like this
RestResponse res = RestContext.response;
String result = JSON.serialize('<the object content>');
String contentLength = String.valueOf(Blob.valueOf(result));
res.responseBody = Blob.valueOf(result);
//res.addHeader('Transfer-Encoding', 'gzip');// this line will get error: We are down for maintenance. So I comment it out.
//res.addHeader('Content-Length', '' + contentLength.length()); // this line will get error also b/c Content-Length cannot not set manual

and the respone will like this
cache-control →s-maxage=0
content-type →application/json;charset=UTF-8
date →Tue, 10 Oct 2017 03:18:35 GMT
transfer-encoding →chunked
x-xss-protection →1; mode=block
I want Content-Length return on the header, but it does not when ransfer-encoding -> chunked.
 
I'm implement a Rest API that return an attachment file. But the respone always return Transfer-Encoding: chunked. As you know, with this type, the Content-Length will not return. I need the Content-Length to show progess bar at client side.
But when I change the Transfer-Encoding to other types like gzip, deflate,compress, identity. The respone always return error: We are down for maintenance.
Please help to show me the way to change this, or how can I set the Content-Length
my code code look like this
RestResponse res = RestContext.response;
String result = JSON.serialize('<the object content>');
String contentLength = String.valueOf(Blob.valueOf(result));
res.responseBody = Blob.valueOf(result);
//res.addHeader('Transfer-Encoding', 'gzip');// this line will get error: We are down for maintenance. So I comment it out.
//res.addHeader('Content-Length', '' + contentLength.length()); // this line will get error also b/c Content-Length cannot not set manual

and the respone will like this
cache-control →s-maxage=0
content-type →application/json;charset=UTF-8
date →Tue, 10 Oct 2017 03:18:35 GMT
transfer-encoding →chunked
x-xss-protection →1; mode=block
I want Content-Length return on the header, but it does not when ransfer-encoding -> chunked.
 
HI All,
We have a third party application which uses Visualforce page as REST API endpoint.
I checked the code and configuration and found there is NO connected app created in salesforce.

I was told that the third party application uses oauth2 to authenticate in Salesforce and sends http request to visual force page url, then reads the content of the visualforce page.
In the loggin history, I can see the login type is "other apex API".
On visualforce page, it is very simple
<apex:page contentType="text/plain; charset=UTF-8" controller="MobileIntegrationController" sidebar="false" showHeader="false" showChat="false" action="{!init}">
    {!responseString}
</apex:page>

It uses controller to generate the responseString and put as the content of the VF page.

Can someone please help me on this?

Thanks,
David
OAUTH ErroR code 1800

Hi Team,


we are logging into salesforce through native mobile app and autharizing through connected APP. But  i am getting Ouath error if i keep the login page idle for more than 10 minutes.

 we need to show different error message if this issue happens. Please let me know if any one has came across this scenario.

Thanks,
Kumar
  • November 08, 2016
  • Like
  • 0
Hi Team,


we are logging into salesforce through native mobile app and autharizing through connected APP. But  i am getting Ouath error if i keep the login page idle for more than 10 minutes.

 we need to show different error message if this issue happens. Please let me know if any one has came across this scenario.

Thanks,
Kumar
  • November 08, 2016
  • Like
  • 0
Hi All,

We are currently working on OAuth 2.0 User Agent flow where our Mobile App connects with Salesforce through a Connected App.

Although most of the time, user gets authenticated and authorized accurately. There are some instances where we see OAuth Error page (see the below image) instead of redirecting the User to appropriate redirection page.

We haven't been able to identify the cause for this behavior but we do know that the User trying to authenticate and authorize himself can be
  • New User
  • Existing User
  • Provide Corrector Incorrect credentails.
Any one has come across this behavior and has been able to idenitify the root cause ?


OAuth Error

I'm working with the Force.com Integration Workbook.  Everything is fine until I get to Tutorial #3! 

 

The workbook talks about setting up Remote Access; however Remote Access is no longer available and you're redirected back to App | Connected Apps.  At this point the workbook doesn't match the latest version of Salesforce (Summer 13).

 

Additionally, in Tutorial 3, Step 2, I cannot get the OAuth to work!  I get the error:

 

HTTP Status 401: Authentication Failed: OAuth login invalid or expired access token

 

I've set this up twice and I'm following the steps "exactly" as they are laid out in the workbook.  Was wondering if anyone else has come across this and if I'm simply missing something.  I'm pretty new to the coding side of SFDC; so I'm working through these workbooks to try and get a better understanding!

 

Thank you!

 

I'm trying to set up a remote access application so I can use OAuth and then the API from my application. I set up a brand-new developer account today and followed the instructions here:

 

https://na7.salesforce.com/help/doc/user_ed.jsp?section=help&target=remoteaccess_authenticate.htm&loc=help&hash=access_data

 

I'm using an OAuth library in Ruby (the 'oauth' gem).

 

So far, I've been able to succesfully retrieve a request token, and when I use that token I can authenticate with salesforce using the login URL metnioned. However, after succesful login my browser gets redirected to an error page (it looks like a few redirects happen, but I can't tell exactly). Finally I get an error message that says "Remote Access Authorization Error" and then "There was a problem setting up your remote access". The URL in the browser looks like this:

 

https://na7.salesforce.com/setup/secur/RemoteAccessErrorPage.apexp?oauth_error_code=1800

 

This error code, alas, is not listed amongst those in the documentation.

 

This happens whether I go through the login step as my developer user, or as a friend's user on an Enterprise account.

 

Any ideas about what's going on here?

 

I can't seem to get past this problem.  Any ideas?

 

Thanks,

Mike