Facing issue with otm-android app: Error message: [Invalid signature]

57 views
Skip to first unread message

Ulhas Shah

unread,
Apr 21, 2017, 6:34:38 AM4/21/17
to opentreemap-user
Hi,

I want to compile the otm-android app.

All the config files are properly set for my otm server.

But while running the otm-android app in debug mode I am getting the below message,


W/AZ_OTM: Error in HTTP request. Status [400] Message [Invalid signature]
          cz.msebera.android.httpclient.client.HttpResponseException: BAD REQUEST
              at com.loopj.android.http.AsyncHttpResponseHandler.sendResponseMessage(AsyncHttpResponseHandler.java:446)
              at com.loopj.android.http.AsyncHttpRequest.makeRequest(AsyncHttpRequest.java:160)
              at com.loopj.android.http.AsyncHttpRequest.makeRequestWithRetries(AsyncHttpRequest.java:177)
              at com.loopj.android.http.AsyncHttpRequest.run(AsyncHttpRequest.java:106)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
              at java.lang.Thread.run(Thread.java:818)
E/AZ_OTM: Unable to load tree map:null
          cz.msebera.android.httpclient.client.HttpResponseException: BAD REQUEST
              at com.loopj.android.http.AsyncHttpResponseHandler.sendResponseMessage(AsyncHttpResponseHandler.java:446)
              at com.loopj.android.http.AsyncHttpRequest.makeRequest(AsyncHttpRequest.java:160)
              at com.loopj.android.http.AsyncHttpRequest.makeRequestWithRetries(AsyncHttpRequest.java:177)
              at com.loopj.android.http.AsyncHttpRequest.run(AsyncHttpRequest.java:106)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
              at java.lang.Thread.run(Thread.java:818)


and on the application in the AVD show the error message Unable to load tree map:null

What should I do for the Invalid signature error?

Justin Walgran

unread,
Apr 21, 2017, 11:47:04 AM4/21/17
to opentree...@googlegroups.com
Does your default.xml file contain access_key and secret_key values? If you have not yet created a pair of API access keys, you can use the Django shell to create them, and then add them to your default.xml.

cd /usr/local/otm/app/opentreemap 
python manage.py shell
>>> from api.models import APIAccessCredential
>>> key = APIAccessCredential.create()
>>> print key.access_key
>>> print key.secret_key

--
You received this message because you are subscribed to the Google Groups "opentreemap-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentreemap-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ulhas Shah

unread,
Apr 21, 2017, 1:16:54 PM4/21/17
to opentreemap-user
Yes..
I have added those keys in the default.xml

The app was working a week back..

But now it's giving this error...

Ulhas Shah

unread,
Apr 24, 2017, 5:08:46 AM4/24/17
to opentreemap-user
Hi,

I was checking the api url from the browser i.e http://treebook.metastudio.org/api/v3/locations

so i am getting this message on the screen

{"status": "Failure", "reason": "URL or resource not found"}

what does this indicate?

Is it that the api is not running?

if not then what may be tested and how to start the api service?

Justin Walgran

unread,
Apr 24, 2017, 1:01:43 PM4/24/17
to opentree...@googlegroups.com
You will not be able to make API requests from the browser, because the API requires that all requests include HMAC signatures.

This is the view decorator function that validates API request signatures.


The signature includes a timestamp, and if the timestamp is more than 15 minutes told, the request is considered invalid


It is possible that there is a discrepancy between the clock time that the mobile app is using to sign API requests and the clock time on the server. The timestamp is included in the API request url, so you will be able to see them in the nginx request logs.

GET /api/v4/user?access_key=…&timestamp=2017-04-24T16%3A43%3A19


--

Ulhas Shah

unread,
Apr 29, 2017, 7:43:59 AM4/29/17
to opentreemap-user
Thank you for the guidance.

after checking the nginx error logs I found that the time stamp was not proper.

Then i realised that I had changed the time zone to Indian time zone in default_settings.py

So I reverted it back to default time zone and the app got connected..

Thanks once again...
To unsubscribe from this group and stop receiving emails from it, send an email to opentreemap-us...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages