I am using flag module to bookmark the content. Authenticated user can normally flag the content. For anonymous user when they click on flag link it should go to login page. After successful login it should flag the node automatically.
I have the code for flagging the content, but I could find how to flag after login.
$flag = flag_get_flag('wishlist');
$flag->flag('flag', $nid, user_load($uid), TRUE);