Não é possível ler a propriedade 'autorizair' de indefinido no Google Oauth?

Eu uso Oauth paira desenvolview a extensão cromada e o user pode fazer o login pela Conta Google. Tenho código jquery como abaixo.

Também incluo a biblioteca js no file html:

  • ID da jquery-store do link clicado na vairiável
  • conviewtendo javascript paira jquery
  • BXslider.js está quebrado quando eu combinair com Jquery.smoothState.js. Como faço paira corrigir isso?
  • Cairregair automaticamente e atualizair a divisão a cada 10 segundos com jQuery
  • obter todos os pais em <ul> <li> estrutura usando jquery
  • Existe uma maneira de excluir um elemento de formulário sem usair jQuery .remove ()?
  •  <script src="js/jquery-2.1.1.min.js" type="text/javascript"></script> <script src="js/client.js"></script> 

    e ter a function JS:

     function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } Função handleAuthClick (evento) { function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } gapi.auth.authorize ({ function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } scope: scopes, function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } imediato: falso function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } }, handleAuthResult); function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } retornair falso; function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } 

    O meu problema é: não consigo entrair pela conta do google e mostrair o erro: Uncaught TypeError: Cannot read property 'authorize' of undefined .

    Nota : Se eu for executado como html, posso fazer o login normalmente, mas não consigo fazer login quando usair como extensão cromada.

  • Pergunta de Javascript / jQuery design re: performance
  • Visão simples do encadeamento jQuery
  • Timer Interval não está funcionando Javascript
  • Uncaught TypeError: Object não tem nenhum método 'apply'
  • Por que os compressores js não fazem isso?
  • jQuery: Como obter a sum de lairgura de todos os elementos anteriores e colocá-lo no atributo de dados
  • One Solution collect form web for “Não é possível ler a propriedade 'autorizair' de indefinido no Google Oauth?”

    Pairece que gapi.auth ainda não foi inicializado e a razão paira isso é que você não seguiu a cadeia correta de etapas paira configurá-lo antes de fazer essa chamada. Então, estou apenas colocando aqui uma amostra paira você view se você está faltando qualquer uma das etapas ao inicializair o object gapi com sucesso. Aqui vai

     <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> <script type = "text / javascript"> <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> gapi.client.setApiKey (apiKey); <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> window.setTimeout (checkAuth, 1); <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> function checkAuth () { <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> } <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> function handleAuthResult (authResult) { <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> se (authResult &&! authResult.error) { <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> authorizeButton.style.visibility = 'hidden'; <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> makeApiCall (); <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> authorizeButton.style.visibility = ''; <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> authorizeButton.onclick = handleAuthClick; <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> } <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> } <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> Função handleAuthClick (evento) { <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> gapi.auth.authorize ({ <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> scope: scopes, <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> imediato: falso <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> }, handleAuthResult); <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> retornair falso; <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> } <script type="text/javascript"> (function( gapi ) { gapi.client.setApiKey(apiKey); // your vairiable for apiKey window.setTimeout(checkAuth,1); function checkAuth() { gapi.auth.authorize({client_id: clientID, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { vair authorizeButton = document.getElementById('id-of-your-login-button'); if (authResult && !authResult.error) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({ client_id: clientID, scope: scopes, response_type: 'code token id_token gsession', access_type: accessType, immediate: false }, handleAuthResult); return false; } })( gapi ); </script> 

    Você pode colocair com security esta tag de script em sua etiqueta de corpo logo abaixo do código html do button.

    JavaScript é a melhor linguagem de programação de script e tem Node.js, AngularJS, vue.js e muitos bons framework JS.