ownerId is always null

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.

Thanks

You add user token in “create” request?

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

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 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]

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 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}

Why would I be getting this?

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.

Method:POST
url:https://api.backendless.com/v1/users/login
post data:{\"password\":\"WWoqbWwU\",\"login\":\"myEmail@gmail.com\"}
Headers (filtered): application-id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\nsecret-key: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\napplication-type:REST\ncontent-type:application/json\n{\"lastLogin\":\"04/28/2014 02:58:42 GMT+0000\",\"updated\":\"04/26/2014 19:30:00 GMT+0000\",\"created\":\"04/26/2014 17:57:38 GMT+0000\",\"email\":\"myEmail@gmail.com\",\"ownerId\":null,\"objectId\":\"46A1FD1D-2F80-8F89-FFAF-F413436F2D00\",\"name\":\"Username\",\"user-token\":\"6048F9C3-3E48-D069-FF7D-653586E85B00\",\"user_flower\":null}"   

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}"

Thanks

Just to make sure I understood what you are doing:

  1. You login first time
  2. Restart your app
  3. Login second time (same user account)
  4. Use user-token from the second login to add an object to the “flower” table

Did I miss anything?

Regards,
Mark

[reply user_id=1][h4]Mark Piller wrote:[/h4]Just to make sure I understood what you are doing:

  1. You login first time
  2. Restart your app
  3. Login second time (same user account)
  4. Use user-token from the second login to add an object to the “flower” table

Did I miss anything?

Regards,
Mark[/reply]Yes you are right.

For step 2) there is no user logout (I haven’t implemented). I hope this wouldn’t screw up the next login at 3).

Thanks

Hi would it be helpful if I send you my account info?

Thanks