Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49184

Ionic authentication not working since today

$
0
0

@r2get wrote:

hello, i was using ionic user to get a device token because my app is using push. But since today it seems this is not working anymore? now my live app does not work anymore

here is the code

                // kick off the platform web client
    Ionic.io();
   //set up push
    var push = new Ionic.Push({
        "debug": false,
        "onNotification": function(notification) {
            var payload = notification.payload;
            //console.log(notification, payload);
        },
        "onRegister": function(data) {
            console.log('onregister.. '+data.token);
            //loginService.setDeviceToken(data.token, $cordovaDevice.getPlatform());
        },
        "pluginConfig": {
            "ios": {
                "badge": true,
                "sound": true,
                "clearBadge": true,
                "alert": true
            },
            "android": {
                "senderID": "571532893160",
                "iconColor": "#f06d27",
                "sound": true,
                "vibrate": true,
                "clearNotifications": true,
                "forceShow": true
            },
            "windows": {
            }
        }
    });

    //setup user
    var user = Ionic.User.current();
        user.id = jwtHelper.decodeToken($auth.getToken()).data.user_id;
        user.set('firstname', $rootScope.bringer_firstname);
        user.save();

    //callback
    var callback = function(data) {
        console.log('Registered token:', data.token);
        console.log(data.token);
        push.addTokenToUser(user);
        user.save();

        ////save token to database
        if (data.token) {
            loginService.setDeviceToken(data.token, $cordovaDevice.getPlatform());
        }
    }

    //register user
    push.register(callback);

what can i do???

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49184

Trending Articles