I log-in successfully with a user and can see the user-token in the login response. Then I create an entry in the table Flower which immediately appears in the online table viewer.
But the entry’s ownerId is always null. What am I doing wrong?
My User table’s data permissions are all green.
My Flower table’s data permissions are all green for authenticated users.
I even made a one-to-one relationship between User and Flower.
I think my problem is I’m not logged in correctly even though appearing so. If after I log in I change to restrict any access of the table to non-authenticated users, then I can no longer search/post.
Could me connecting to Backendless through a php proxy be a cause?
[reply user_id=76][h4]Катя Максименко wrote:[/h4]You add user token in “create” request?[/reply][reply user_id=76]
[/reply][reply user_id=76][h4]Катя Максименко wrote:[/h4]You add user token in “create” request?[/reply]I don’t know how. I’m following this http://backendless.com/documentation/data/rest/data_saving_data_objects.htm
[reply user_id=76][h4]Катя Максименко wrote:[/h4]Your Request Headers should look like this:
application-id: app-id-value
secret-key: secret-key-value
user-token: value-of-the-user-token-header-from-login
Content-Type:application/json
application-type: REST[/reply][reply user_id=76]Ok I tried if I append for example[/reply][reply user_id=76]user-token:EADA5B81_8E58_D3B6_FF79_FCEB8A45AD00[/reply][reply user_id=76]then posts no longer show up in the table. If I remove this header they do[/reply]
[reply user_id=76][h4]Катя Максименко wrote:[/h4]Your Request Headers should look like this:
application-id: app-id-value
secret-key: secret-key-value
user-token: value-of-the-user-token-header-from-login
Content-Type:application/json
application-type: REST[/reply]The reason with user token my posts do not show up in table is due to:
{“message”:“Not existing user token. Relogin user to update your user token”,“code”:3064}
How long has it been since you received the user-token which you send to the server? user tokens DO expire and you cannot use the same one if you got it some time ago.
[reply user_id=1][h4]Mark Piller wrote:[/h4]What does the server return when you create a record WITH user-token?
Is it possible for you to capture the request (headers and body) and response and post them here?
Regards,
Mark[/reply]
This is the result of what my http_proxy.php returns with my debug statement turned on, when I log in. You can see Backendless’ json response at the end.
At this point I cannot continue to POST to my table because the debug prints invalidate the login json response above. Thus I quit the application and restart. This time I turn off debug printing to login successfully (now with different user-token). Then I turn back on debug printing to see what happens when I POST to a table:
Method:POST
url:https://api.backendless.com/v1/data/flower
post data:{\"lat\":37.72570990000001,\"name\":\"marker_heart\",\"lon\":-122.44092032713577,\"desc\":\"red heart\",\"parent\":\"\"}
Headers (filtered): application-id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\nsecret-key: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\napplication-type:REST\ncontent-type:application/json\nuser-token:89267351_5AC6_0F2B_FF96_BAB48A37E500\n{\"message\":\"Not existing user token. Relogin user to update your user token\",\"code\":3064}"