John Goddard
Posts: 0
Joined: Sat Apr 04, 2015 11:55 pm

Cannot retrieve Salesforce data

Dear Appery

I have a newbie question.

I am trying to make a basic application which will read from Salesforce custom object and display the results

I have followed the appery Salesforce tutorial, but cannot get the app to retrieve data - specifically:

-When I use the Salesforce Query Service in Appery I CAN see data returning via the test button
-When I run my app in either the browser or mobile device, I CANNOT see data, it throws an error via debug which is "GET https://api.appery.io/rest/1/proxy/tu... 401 (Unauthorized)"

After much experiementation, I have determined the following:

-If I enable "echo" via the service, my app does retrieve data (but I believe echo is just static data from the time the query was run on in dev, so is no help)
-My issue sounds the same as https://getsatisfaction.com/apperyio/...

I think this is an issue to do with authorization / authentication / OAuth / proxy between Appery and Salesforce, but I am stuck.

Any help would be appreciated

Thanks

John

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Cannot retrieve Salesforce data

Hello John,

I CANNOT see data, it throws ... 401 (Unauthorized)

You need to set header Authorization with token, or you will get 401 every time.

John Goddard
Posts: 0
Joined: Sat Apr 04, 2015 11:55 pm

Cannot retrieve Salesforce data

Hi Igor

In the header of my query service I do have the Authorization defined
Image

I also have all the Salesforce values defined in Salesforce_Settings
Image

The actual error I am receiving in browser debug is
0: {message: "Session expired or invalid", errorCode: "INVALID_SESSION_ID"}
errorCode: "INVALID_SESSION_ID"
message: "Session expired or invalid"

I can successfully query the service via the "test" option, so I assume my Salesforce settings must be correct.

Sorry if I am missing something obvious...

Any help greatly appreciated

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Cannot retrieve Salesforce data

Hi John,

Sorry for radio silence here, we'll post an update as soon as possible.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Cannot retrieve Salesforce data

Hello John, where did you received session token, from the same app?

John Goddard
Posts: 0
Joined: Sat Apr 04, 2015 11:55 pm

Cannot retrieve Salesforce data

Hi Sergly, I copied the example https://devcenter.appery.io/tutorials... word for word and have tested it via the web browser test option in Appery. So I assume I am receiving the session token from my app itself when I authenticate to Salesforce.

I would be interested to know if you are also able to get the example working as I have tried several times without success.

Sorry if I have made a simple mistake somewhere, but I am not able to see what I have done differently from the instructions...

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Cannot retrieve Salesforce data

Hello John,

Hard to say then.
Please find backup of working app here https://drive.google.com/a/exadel.com...

Return to “Issues”