Why do I need to login again to Cloud for push notification?

147 views
Skip to first unread message

Oleg Polyakov

unread,
Mar 19, 2013, 12:44:32 PM3/19/13
to node...@googlegroups.com
Greetings,

I have the following use case.

Titanium App -> calls Node.ACS service (does the login, returns some data to client) -> Titanium App gets device token from Titanium.Network.registerForPushNotifications

-> Titanium App tries to subscribeToServerPush


The subscribeToServerPush is failing because my Node.ACS login didn't seem to take effect.  If I do a manual login to Cloud.Users.login it will work.  But obviously, I don't want to login twice one through Node.ACS and one within client calling Cloud.


Second question is there a tutorial anywhere that shows how to trigger push notifications from Node.ACS.  I only tested push notifications from cloud appcelerator console.

Regards,
Oleg

Oleg Polyakov

unread,
Mar 19, 2013, 12:47:58 PM3/19/13
to node...@googlegroups.com

Wei Kong

unread,
Mar 19, 2013, 1:04:52 PM3/19/13
to node...@googlegroups.com
Hi Oleg,

Did you pass in the req, res to the ACS call from the node.ACS side. You want to make sure you pass along the user session from the client to the server.

Wei

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

Oleg Polyakov

unread,
Mar 19, 2013, 2:31:16 PM3/19/13
to node...@googlegroups.com
What do you mean "pass req, res to the ACS call from the node.ACS side"?  My node.acs for login looks like this
ACS.Users.login({login: username, password: password}, loginCallback, req, res);

I don't think subscribe accepts session_id as a parameter http://cloud.appcelerator.com/docs/api/v1/push_notifications/subscribe

I can try manually pass session_id from node.acs to titanium client, and pass it subscribe call

Cloud.PushNotifications.subscribe({

        channel : 'friend_request',

        type : 'ios',

        device_token : user_device_token,

        session_id: session_id


If you check the gist - https://gist.github.com/opolyo01/5197701 it works fine with login, but skipping login call returns "Error:\n You need to sign up before continuing"

Wei Kong

unread,
Mar 19, 2013, 2:35:27 PM3/19/13
to node...@googlegroups.com

ricardosau...@gmail.com

unread,
Apr 20, 2015, 5:36:00 PM4/20/15
to node...@googlegroups.com
Sorry I'm also struggling with this, you think it fails platform?
Do not give me access to the cloud.
Your code is to send Push Notifications from a real web server?

Wei Kong

unread,
Apr 20, 2015, 5:40:50 PM4/20/15
to node...@googlegroups.com, ricardosau...@gmail.com
Basically the problem is that you need to pass in a valid session in order for notify.json call to work. it requires validate user authentication. 
Reply all
Reply to author
Forward
0 new messages