Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init

If you are facing this issue, Gapi is not defined – Google sign-in issue with gapi.auth2.Init, The most common problem is you have async and…

The post Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init appeared first on CodeSource.io.


This content originally appeared on CodeSource.io and was authored by Deven

If you are facing this issue, Gapi is not defined – Google sign-in issue with gapi.auth2.Init, The most common problem is you have async and defer attributes on your script tag. Please note that gapi should be loaded after your script tag with gapi.auth2.init .

Consider the example below:

<script src="https://apis.google.com/js/platform.js?onload=onLoadCallback" async defer></script>
<script>
window.onLoadCallback = function(){
  gapi.auth2.init({
      client_id: 'You_client_Id_HERE.apps.googleusercontent.com'
    });
}
</script>

In the snippet above to wait for gapi before executing the code you have to use onload query param in the script tag.

The post Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init appeared first on CodeSource.io.


This content originally appeared on CodeSource.io and was authored by Deven


Print Share Comment Cite Upload Translate Updates
APA

Deven | Sciencx (2021-02-11T06:57:37+00:00) Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init. Retrieved from https://www.scien.cx/2021/02/11/fix-gapi-is-not-defined-google-sign-in-issue-with-gapi-auth2-init/

MLA
" » Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init." Deven | Sciencx - Thursday February 11, 2021, https://www.scien.cx/2021/02/11/fix-gapi-is-not-defined-google-sign-in-issue-with-gapi-auth2-init/
HARVARD
Deven | Sciencx Thursday February 11, 2021 » Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init., viewed ,<https://www.scien.cx/2021/02/11/fix-gapi-is-not-defined-google-sign-in-issue-with-gapi-auth2-init/>
VANCOUVER
Deven | Sciencx - » Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/02/11/fix-gapi-is-not-defined-google-sign-in-issue-with-gapi-auth2-init/
CHICAGO
" » Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init." Deven | Sciencx - Accessed . https://www.scien.cx/2021/02/11/fix-gapi-is-not-defined-google-sign-in-issue-with-gapi-auth2-init/
IEEE
" » Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init." Deven | Sciencx [Online]. Available: https://www.scien.cx/2021/02/11/fix-gapi-is-not-defined-google-sign-in-issue-with-gapi-auth2-init/. [Accessed: ]
rf:citation
» Fix – Gapi is not defined – Google sign in issue with gapi.auth2.init | Deven | Sciencx | https://www.scien.cx/2021/02/11/fix-gapi-is-not-defined-google-sign-in-issue-with-gapi-auth2-init/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.