Custom Mobile App with custom airnotifier

Custom Mobile App with custom airnotifier

by Vivek Kalyanarangan -
Number of replies: 3

Airnotifier server is getting a 400 POST "invalid token" error everytime I try to enable notifications from the app.


I have tried with the airnotifer main as well as with the moodlehq branch but the result is the same. My site: http://courses.unp.education/

I have tried with multiple users, re-installing airnotifier. 

I have valid GCM auth and have it configured with airnotifier. 

Airnotifier is configured with moodle. 

GCM Project number is updated in the config.json of the app

Apparently airnotifier thinks that the token is invalid. 

Airnotifier Logs:

INFO     Starting AirNotifier server

INFO     AirNotifier is running

INFO     304 GET /applications/comunpunpmobile/settings (182.75.26.30) 14.22ms

INFO     304 GET /static/css/bootstrap.min.css?v=282663d1dc8a60dcef58304c09005aa5 (182.75.26.30) 2.73ms

INFO     304 GET /static/css/dashboard.css?v=6c04d16dac1c8f1e0fc66ac205c0e44a (182.75.26.30) 0.66ms

INFO     304 GET /static/js/bootstrap.min.js?v=bed31fb959612a0a77d8e87b9d0b3683 (182.75.26.30) 0.61ms

INFO     304 GET /static/js/jquery-1.11.0.min.js?v=8fc25e27d42774aeae6edbc0a18b72aa (182.75.26.30) 0.70ms

INFO     304 GET /static/img/glyphicons-halflings.png (182.75.26.30) 0.67ms

INFO     304 GET /applications/comunpunpmobile/keys (182.75.26.30) 11.83ms

WARNING  400 POST /tokens/deUCuhCf_AA:APA91bHFJ5kJhxhkoiuRWf3X5ZpGVj5xOpDChVMZ4-f1T2EAw1ZQ6beciVWTL05keXYUDkGXKPI93EFGip7a-JhxIKfNDR7MxwgHDUtcyaIViPR9F-SsSXr9rluEDlqg0moShZet2_Cs (52.77.231.1) 1.25ms

WARNING  400 POST /tokens/deUCuhCf_AA:APA91bHFJ5kJhxhkoiuRWf3X5ZpGVj5xOpDChVMZ4-f1T2EAw1ZQ6beciVWTL05keXYUDkGXKPI93EFGip7a-JhxIKfNDR7MxwgHDUtcyaIViPR9F-SsSXr9rluEDlqg0moShZet2_Cs (52.77.231.1) 1.12ms

WARNING  400 POST /tokens/deUCuhCf_AA:APA91bHFJ5kJhxhkoiuRWf3X5ZpGVj5xOpDChVMZ4-f1T2EAw1ZQ6beciVWTL05keXYUDkGXKPI93EFGip7a-JhxIKfNDR7MxwgHDUtcyaIViPR9F-SsSXr9rluEDlqg0moShZet2_Cs (52.77.231.1) 1.15ms


I tried the same request from POSTMAN (Chrome app) and getting the same "invalid token" error. Please help!

Average of ratings: -
In reply to Vivek Kalyanarangan

Re: Custom Mobile App with custom airnotifier

by Hittesh Ahuja -

Umm you could probably look at the airnotifier table in moodle ( for devices) to see that the device token matches what is being sent by AN. 


Hittesh

In reply to Hittesh Ahuja

Re: Custom Mobile App with custom airnotifier

by Vivek Kalyanarangan -

I tried that too...

I also tried purging the table and trying again. If I am not thinking wrong this table is mdl_user_devices.

Verified the device key like you suggested but they look the same.

Also looked through the php code on manager.php at moodle_home/message/output/airnotifier/classes/ folder but the request population logic looked in alignment with the API documentation on airnotifier.

I still can't conclude whether it's an issue at airnotifier end or moodle end.

Please suggest a way forward. Thanks in advance!

In reply to Vivek Kalyanarangan

Re: Custom Mobile App with custom airnotifier

by Hittesh Ahuja -
Do you have a token listed in Air notifier. If so, you could try sending a broadcast message and see if you get anything. You could also look at the airnotifer tables in Moodle. I believe there are two can't remember what they are called now. Also make sure you have the right gcmp and api key in your airnotifer