             var callback:Function = null;
             switch( event.code ) {
                 case TOKEN_RECEIVED:
-                    triggerTokenCallbacks( event.level );
+                    if( mIdsAvailableCallback !== null ) {
+                        responseJSON = JSON.parse( event.level );
+                        mIdsAvailableCallback( responseJSON.userId, responseJSON.pushToken );
+                        /* Remove the callback if the push token is available */
+                        if( "pushToken" in responseJSON ) {
+                            mIdsAvailableCallback = null;
+                        }
+                    }
                     return;
                 case NOTIFICATION_RECEIVED:
                     triggerNotificationCallbacks( event.level );

        private static const POST_NOTIFICATION_ERROR:String = "postNotificationError";

        /* Callbacks */
        private static var mTokenCallbacks:Vector.<Function> = new <Function>[];
        private static var mNotificationCallbacks:Vector.<Function> = new <Function>[];
        private static var mCallbackMap:Dictionary;
        private static var mCallbackIdCounter:int;


        /**
         * Adds callback that will be called when user registers for notifications and push token is received.
         *
         * <p>There can only be one callback registered at a time, and it is automatically removed when
         * the push token is received. You can remove it manually by passing in <code>null</code>.</p>
         *
         * @param callback Function with the following signature:
         * <listing version="3.0">
         * function callback( oneSignalUserId:String, pushToken:String ):void {
         *    // pushToken may be null if there's an error (server side, connection error...)
         * };
         * </listing>
         */
        public static function idsAvailable( callback:Function ):void {
            if( !isSupported || !initExtensionContext() ) return;

            mIdsAvailableCallback = callback;
            if( mIdsAvailableCallback !== null ) {
                mContext.call( "idsAvailable" );
            }
        }

