Comments (5)
Try checking if both devices (server and android) have their clocks set correctly. The codes are time-based, so if the clocks are too far apart the codes will not match properly.
from android-channel.
So, does this also mean that both should be in the same time zone ?
from android-channel.
The timestamps are UTC, so no, they do not need to be in the same timezone, but they do both need to be correct.
To debug this I would add some prints to:
https://github.com/rapidpro/rapidpro/blob/master/temba/channels/views.py#L216
That's the view that handles syncs and such.
from android-channel.
The problem is you got a difference of time (between your android phone and your computer) > to 15 min. So after i noticed i had a difference of 4 hours, i changed the code to accept the difference of 5 hours.
The code to change is this one https://github.com/rapidpro/rapidpro/blob/master/temba/channels/views.py#L216 (line 239)
original code:
check that the request isn't too old (15 mins)
now = time.time()
if abs(now - int(request_time)) > 60 * 15:
return HttpResponse(status=401, content='{ "error_id": 3, "error": "Old Request", "cmds":[] }')
changed code:
now = time.time()
if abs(now - int(request_time)) > 60 * 300:
print "DIFF:%s" % (now - int(request_time))
print "NOW: %s" % datetime.fromtimestamp(int(now)).strftime('%Y-%m-%d %H:%M:%S')
print "REQUEST TIME %s" % datetime.fromtimestamp(int(request_time)).strftime('%Y-%m-%d %H:%M:%S')
print "DIFFERENT TIME (old request)"
return HttpResponse(status=401, content='{ "error_id": 3, "error": "Old Request", "cmds":[] }')
from android-channel.
This is by design to prevent replay attacks. There's no valid scenario where your phone should be more than 15 minutes off from your server, it will cause headaches down the line.
from android-channel.
Related Issues (10)
- Add support for RCS
- Routing message when using two channels HOT 2
- Firebase Cloud Messaging setup required to run app -- but is it used? HOT 1
- Attachment / Image support via MMS? HOT 1
- Wrong URL on claim screen
- the android gateway does not synchronize itself
- Configured URLs cannot use https HOT 5
- Make the sync polling interval configurable HOT 2
- Convert to newer gradle style project
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-channel.