timanrebel / Parse

Appcelerator Titanium module for the Parse SDK
MIT License
47 stars 31 forks source link

Get Session Token #14

Open almsx opened 9 years ago

almsx commented 9 years ago

Hello,

I am implementing Push Notifications and your module has dropped me great. However, I tried to implement it in my Application and gives me the following error:

 DefaultRequestDirector: Authentication error: Unable to answer-to any of These challenges: {}

I see the README to do a process of Authentication, and passed as a parameter the Session Token.

How do I get this Token?

Below is my code in index.js:

    var Parse = require('eu.rebelcorp.parse');
Parse.authenticate('<your session token>');
Parse.start();

// To enable Android Push Notifications
Parse.enablePush();

// Subscribe of unsubscribe to Parse Channels
Parse.subscribeChannel('myCanalMX');

Parse.addEventListener('notificationreceive', function(e) {
    alert("notification: ", JSON.stringify(e));
});

Parse.addEventListener('notificationopen', function(e) {
    alert("notification: ", JSON.stringify(e));
});

Thank you very much in advance and a hug from Mexico

timanrebel commented 9 years ago

Hi @almsx,

The session token is only used to link the Push Notification token to a logged in Parse User. If you don't use that, you don't need a session token.

Have you also added the Parse keys in your tiapp.xml?

almsx commented 9 years ago

Hi @timanrebel

These lines correspond to my tiapp.xml leagues including authentication of Parse

<android xmlns:android="http://schemas.android.com/apk/res/android">
<property name="Parse_AppId" type="string">bn26VA7yDzN6NRe4VHbOSwM5XJ8IOVJy1UrxnBOa</property>
<property name="Parse_ClientKey" type="string">ZN3YV2joKE98fte7xECdapU7348j4tv3r1rscP7e</property>
</android>

But does not send any notification, and Console throws me the following error:

DefaultRequestDirector: Authentication error: Unable to respond to any of these challenges: {} DefaultRequestDirector: Authentication error: Unable to respond to any of these challenges: {} DefaultRequestDirector: Authentication error: Unable to respond to any of these challenges: {} DefaultRequestDirector: Authentication error: Unable to respond to any of these challenges: {}

I appreciate your support :)

Best, Alberto Luebbert

timanrebel commented 9 years ago

Could you move those lines outside the <android> tags?

Can you see Installations in the Parse backend?

almsx commented 9 years ago

I dont, only see the iOS devices registered.

I moved the labels property off android tags and authentication error is gone

timanrebel commented 9 years ago

Hopefully that also created the Android devices in Installation. Could you tell me if that is the case or not?

almsx commented 9 years ago

Unfortunately dont; I attach image in Installation.. My configuration is as follows, as if that could be causing this situation:

Appcelerator Titanium 3.4.1 CLI Titanium SDK 3.2.3.GA NodeJS v0.10.13 OSX 10.9.5

Image of PushNotifications

timanrebel commented 9 years ago

Are you testing it on an Android device with Google Play installed and logged in on a Google account?

almsx commented 9 years ago

The application was tested on a Motorola G with Android 4.4.4. Has Google Play Services as well as a logued account.

For the purpose of seeing if anything I'm wrong, I would append here to link to the original project and maybe there is something you are doing wrong :(

https://github.com/almsx/PushParseAndroid

Thanks for all your support :)