These days I am working on a Drupal project, where I am supposed to manage our own users and we decided to manage separate table for users. Now the client asked us to create blogs for this as well. In our previous flow, we were treating our system users as anonymous users for Drupal. But given the fact that anonymous user cannot create blogs. Then we decided to make our anonymous users a registered users with Drupal. After searching a lot, I found out these pieces of code, which I suppose are great for our system. The code is:
$user = user_load($uid);
Here $uid is the user id, that you want to forcefully login into Drupal system. Using this code, an external system logs in as a registered user and hope fully will be able to write blogs as well. Will let you know as soon as I finish with the blog feature.