$base_url set to an external domain causes problems when logging in
You can set action on after login user.

And that action could trigger through set a perticular trigger.

please use these url to solve this issue in your site.


www.example.com/admin/config/system/actions
www.example.com/admin/structure/trigger/user


Hope this works for you.

Thanks
Sanjay