How to get userId after connect to GP

Hello.
After successfully connecting to GP via Show External Login UI - how to get user ID? Well, or at least something through which you can hook and authorize a user in your external database?