I'm using Google Oauth2 Javascript in a JSP application.
<script src="https://apis.google.com/js/client.js"></script>
function googleOAuth(idx) {
alert ("Please ensure that popup windows are enabled in your browser. You will authenticate directly with Google in another window.");
var config = {
'client_id': '<%=googleClientId%>',
'scope': 'https://mail.google.com/ https://www.googleapis.com/auth/userinfo.email',
'response_type': 'token',
'immediate': false
};
gapi.auth.authorize(config, function() {
var token = gapi.auth.getToken();
/// ...use token
});
}
My app was working fine till yesterday, today its failing to authorize and the Chrome console says:
Uncaught TypeError: undefined is not a function at line cb=gapi.loaded_0:223 The handler function has not executed yet. Line 223 has the following:
var f=c.popup,g=c.after_redirect;f&&"keep_open"!=g&&(0,_.Uu)(window,f)
and I don't see how g&&(0,_.Uu)(window,f) can be valid JS.
Is anyone else seeing this too?
g&&(0,_.Uu)(window,f)is valid JavaScript. It makes use of the comma operator, which returns the value of the second operand. In order for it to make sense here, the value of_.Uushould be a function, because it is immediately called after evaluating the expression. In order to see thatg&&(0,_.Uu)(window,f)is indeed valid, try running it in your console after first executingvar g=true,_={Uu:alert},f=null.