问题
In Google+ JS documentation, it says that if a callback function parameter is specified, Google will call that function when auth flow completes.
How would that work? i.e. how does javascript in parent window get access child window (Google Oauth)'s state?
回答1:
Javascript children windows can call functions in their parent windows. Let's say you specify the function signinCallback(authResult)
, then the auth window can call parent.signinCallback(authResult)
to pass authResult
to your main window.
来源:https://stackoverflow.com/questions/27934815/how-does-google-plus-oauth-callback-function-work